home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / programming / debug / disectv20b / document / disectv2.0.doc < prev   
Encoding:
Text File  |  1996-09-07  |  136.4 KB  |  2,864 lines

  1. * ------------------------------------------------------------------------- *
  2.  
  3.         Disect V2.0 - © DMA 1994-5    20.03.94 -> -> ->
  4.         ==========================    =================
  5.  
  6.  1) Introduction        * READ THIS FIRST !!!
  7.  2) Disect Request Windows    * life will be easier if you read this!
  8.  3) The Program Screen
  9.  4) A Disassembler Tutorial    * DO THIS to realise the potential!
  10.  5) Symbol Selection Window    * life will be easier if you read this!
  11.  6) Address Functions
  12.  7) DataStrings
  13.  8) Key Macros        * life will be easier if you read this!
  14.  9) Expressions        * life will be easier if you read this!
  15. 10) MultiBin Files
  16. 11) Screen Icons Reference
  17. 12) Keyboard Reference
  18. 13) Mouse Reference        * life will be easier if you read this!
  19. 14) Menu Reference
  20. 15) LibList And Known Data Structures
  21. 16) Process Variables Memory
  22. 17) Grabbing An Existing Process
  23. 18) Auto Trace Mode
  24. 19) Hardware Monitor        * only for those who know...
  25. 20) 68020 Modes/Instructions
  26. 21) Installing To Hard Drive
  27. 22) Contact Address        * when you've decided to register...
  28.  
  29. * ------------------------------------------------------------------------- *
  30.  
  31. 1) Introduction
  32. ===============
  33.  
  34.     Welcome! Now, I know what you're thinking... 'I can't be bothered
  35. reading all these dox!'. Well, I'm sorry, but eventually you're going to have
  36. to do so. To try and make things easier, I've commented the contents (above)
  37. to try and steer you in the right direction to begin with. After that, read
  38. either whatever you need to, or whatever you're interested in. And, it goes
  39. without saying, but if at all possible, get a copy of this file printed!
  40.  
  41.     Disect is a very powerful combined disassembler/debugger program,
  42. which has been designed to be easy to use. Its power is achieved at the
  43. expense of memory: the minimum requirement is 1Mb; for larger projects, 2Mb
  44. will be required. The programmer neither encourages nor condones its use to
  45. assist in illegal duplication of copyright software. Disect can be used for
  46. two main purposes: development of software; and the gaining of knowledge
  47. (hacking can be very educational).
  48.  
  49.     The debugger allows an executable file, a disk boot-block, a
  50. binary file, or an area of memory to be loaded and created as a Process. It
  51. is even possible to grab an existing memory-resident Process. A Process's
  52. instructions can be executed individually (in User mode only), or the Process
  53. can be activated, with or without breakpoints installed. System exceptions
  54. can be trapped before they crash the machine, and program symbols can be read
  55. from executable files. It is even possible to save the status and memory of a
  56. Process, as well as its current hardware monitor setup, and reload it later
  57. (although, of course, this is only possible with 'hardware' Processes such as
  58. games, ie: not 'workbench' programs which use the OS).
  59.  
  60.     The disassembler allows a loaded program to be commented, have
  61. blank lines inserted, and have it's numbers and addresses replaced with
  62. constant or program symbols. All the symbols of Release 3 of the system
  63. include files are available to the disassembler. A program which has been
  64. dissected in this way can then be saved as two source files: a program file,
  65. and a support file. The support file will contain EQUs for all required
  66. constant symbols, and any required macro definitions. System constant symbols
  67. can be EQUs (grouped by the SI file where they live), or alternatively the
  68. support file can INCLUDE all required SI files. Disect data files can be
  69. saved, to be reloaded later: 'hold on to your hacks'!
  70.  
  71.     Disect requires Release 2 of the Amiga operating system; it also
  72. requires the ASL library.
  73.  
  74.     If you've paid your shareware fee then you'll have the full
  75. version. Otherwise, the copy you've got is (hopefully) only a demo. This
  76. has a few differences: you cannot disassemble to file; you cannot extract
  77. program symbols from executable files. In addition, you will not have all of
  78. the system symbol data files. If this is so, and since, as I don't doubt,
  79. you'll be impressed by this program, then don't hesitate in registering
  80. today, by sending your name and full address, and a cheque/postal order for
  81. £40, to the address which you'll find at the end of this file. As well as
  82. receiving a registered version, you'll also be entitled to technical support
  83. (by mail) if required. If you like this program, it's well worth the money.
  84.  
  85.     'Disect' is Shareware, Copyright © D.M.Alderson 1994/5, all
  86. rights reserved. Duplication for the purpose of backups is permitted, but
  87. not for the purpose of selling or otherwise distributing the software,
  88. manual, or other related items, which includes '.dsct' data files only for
  89. commercial purposes, without written permission from the author. This does
  90. not apply to the demo version of the software, which in such instances would
  91. include the manual, and other related items, but not including '.dsct' data
  92. files unless for commercial purposes.
  93.  
  94.     The author does not make any warranty, express or implied, with
  95. respect to the software or any related item, their quality, performance, or
  96. fitness for any purpose. It is the responsibility solely of the purchaser
  97. to determine the suitability of the software for any purpose. In no event
  98. will the author be liable for incidental or consequential damages of any kind
  99. in connection with the software product, manual, or other related items and
  100. processes including, but not limited to, any interruption of service, loss of
  101. business, anticipated profit, or other consequential damages. ETC.
  102.  
  103.     Disect was written using a 2 meg A500+ (without a hard drive! -
  104. will people PLEASE hurry up and register?)
  105.  
  106. * ------------------------------------------------------------------------- *
  107.  
  108. 2) Disect Request Windows
  109. =========================
  110.  
  111.     The program takes much of its input through 'request windows'.
  112. These are standard windows containing string and button gadgets, etc. The
  113. more commonly used windows have keyboard shortcuts. Where available, these
  114. consist of the first letter of the text within the gadget (which will be
  115. underlined). One exception is the 'Select Address Base' request: to select
  116. '+ Decimal' you use key 'p'; to select '- Decimal' you use key 'm'.
  117.  
  118.     Many of the windows allow specification of a number of address
  119. ranges (eg: when searching memory). These contain a list of the currently
  120. defined address ranges, and two string gadgets to input the start and end
  121. addresses (inclusive) of a range. You should input the start, and then the
  122. end, after which, if the range is ok, the address range will be stored. Note
  123. that you may not enter zero as an address. For most of the windows, the
  124. ranges list will be initialised to contain the start and end addresses of
  125. any loaded project memory. If you LMB on any address range, it will be
  126. selected, and can then be changed. If you select a range, then enter no
  127. input for the start and end addresses, the range will be deleted from the
  128. list. The RMB can be pressed to un-select a selected address range.
  129.     Instead of having to enter the actual end address into any end
  130. address string gadget, it is possible to instead enter the size of a memory
  131. area, by preceeding it with a comma. You can also enter, for example: '+12',
  132. which will result in an address range of 13 bytes (ie: end address = start
  133. address + 12). For an address range of a single byte, you can simply enter
  134. '='.
  135.  
  136.     Be aware: it is essential to always press Enter when entering
  137. a number or expression into any string gadget, especially during definition
  138. of a key macro.
  139.  
  140.     One last thing: if Disect seems to lock-up, try pressing any
  141. SHIFT key, or any ALT key, or the CTRL key.
  142.  
  143. * ------------------------------------------------------------------------- *
  144.  
  145. 3) The Program Screen
  146. =====================
  147.  
  148.     As of V1.2, Disect incorporates menus for most functions. To
  149. prevent contention between menus, and Disect's use of the RMB, in order
  150. to select from a menu, you must first RMB click on the menu bar, in order
  151. to 'activate' the menus. To disable the menus, and allow Disect to respond
  152. to the RMB in the main window, you simply LMB on the window, away from the
  153. menu bar (for example, on the status/message area).    
  154.  
  155.     At the top of the screen is displayed the available chip and
  156. fast memory, various function icons, and the program's status/message output.
  157. The status message consists of the current state of any Process (--- none,
  158. -S- Process suspended, -A- Process active, -W- Process Wait()ing), info of
  159. any defined disassembly window markers, and the number of address stack
  160. entries. The icons (from left to right) are: 
  161.  
  162.     memory/structures window selector
  163.     auto-data/instruction mode
  164.     address stack (3 icons)
  165.     display INCBIN definitions
  166.     open/close workbench screen
  167.     disassembly window left/right scroll arrows
  168.  
  169.     Below this is the disassembly window area. There can be either
  170. one or two disassembly windows open at once: the tab key will toggle between
  171. single and double window mode. The cursor keys can be used to scroll windows,
  172. while pressing shift also will move a window faster. In double window mode,
  173. pressing the left alt key will select the lower disassembly window. This
  174. applies to the cursor keys as well as other disassembly window keys (eg: A,
  175. 1-9, 0, etc).
  176.     In each disassembly window, you'll find up and down arrow gadgets
  177. for scrolling the window. Normally, these work upon the window in which they
  178. are situated. It is possible, however, to use either pair of arrow gadgets
  179. to scroll the memory window, by also pressing the right ALT key.
  180.  
  181.     Next down is a window which displays the PC and SR values, and
  182. the source effective address (SEA) and destination effective address (DEA) of
  183. the instruction at the PC, when applicable. Also displayed is the content
  184. of these addresses. There are two lines of this: the upper line displays
  185. the current values, while the lower line displays the previous values. This
  186. allows the SEA/DEA content to be seen to be affected after execution of an
  187. instruction, which is not possible with programs which display only the
  188. current values. The upper line can be used to enter new values for the PC
  189. and SR, via LMB on the digits of the PC, or the digits/letters of the SR.
  190. To enter a new SR value, a request window will be opened. This allows input
  191. of either an expression (denary/hex/binary/symbols), or any combination of
  192. the letters XNZVC to denote which flags are to be set: any unspecified flags
  193. will be cleared. If no input is received, then the PC/SR is unaffected. If
  194. the Process is active, then attempting to change the PC or SR will have no
  195. actual effect.
  196.     The third line in this window is the 'register zoom'. This can
  197. be locked to any of the registers d0-d7 or a0-a7, and displays the register
  198. content, and the content of this address and the next 15 bytes upward in
  199. memory, as denary/hex (depending on the currently selected base), and as
  200. ascii characters. The '·' character is displayed for any bytes not within
  201. the ascii range of 32 to 127. The locked register is selected by LMB on the
  202. text of 'd0', 'd1', etc in the register window. The register zoom can also
  203. be locked to the SEA or DEA of the instruction at the PC, if a Process has
  204. been created, by LMB on the text of 'sea=' or 'dea=' in the first line of the
  205. window.
  206.  
  207.     The register window is the lower-left window on the screen, and
  208. this displays the register values as denary/hex. For data registers, the
  209. register content is displayed also as ascii. For address registers, the
  210. register content is also used as an address; the content of this is displayed
  211. as denary/hex and ascii. Any of the registers can be given new values in the
  212. same way as the PC, by LMB on the digits of the register value. A nice little
  213. feature which you may at times find useful is, when entering for an address
  214. register value, instead of an address, you may enter, for example:
  215.  
  216.         >a text string
  217.  
  218. This has the effect of storing all the input text after the '>' character,
  219. and setting the address register to point to the stored text. Disect contains
  220. eight such text buffers, each of which may contain up to 63 characters.
  221.  
  222.     The lower-right window can display either a memory dump, or the
  223. data structure pointers window (see Section 15). The memory dump can be
  224. scrolled using cursor keys and the right alt key. The shift key applies for
  225. the up and down cursor keys as it does for the disassembly window. By LMB on
  226. the address digits, you can input a new address for any of the separate
  227. lines in the window. When you do this, the addresses of any lines below the
  228. affected one will be updated, but any above it will remain unchanged. This
  229. allows, for example, the first line to be locked on one memory location, the
  230. second to be locked on another, and the remaining six lines to be used as a
  231. memory dump starting from yet another address. If you use the cursor keys to
  232. move the window, the first two lines will stay where they are in memory, and
  233. only the continuous block of six lines will be moved. Neat eh? Note that a
  234. much bigger memory dump window can be accessed by pressing 'm'.
  235.     If you have a Process, then try this now: enter the following
  236. into the address area of the first line: PROCP. This will move the window
  237. to the Process structure; the fields of this structure are displayed using
  238. (abbreviations of) the structure field names.
  239.  
  240. * ------------------------------------------------------------------------- *
  241.  
  242. 4) A Disassembler Tutorial
  243. ==========================
  244.  
  245.     The best way to understand something is to do it, so on the disk
  246. you'll find an executable file called 'KeepASL' (in the Tutorial drawer).
  247. This is a little utility I wrote ages ago since I was fed up with having to
  248. reload the ASL after each time I assembled something. All it does is to open
  249. the ASL library and the clipboard device, preventing them from being removed
  250. from memory. So load up Disect, and select 'Load Executable' from the project
  251. menu.
  252.  
  253.     The next request allows you to define whether or not to create a
  254. Process, and extract any symbols from the executable file. Leave these un-
  255. checked (you don't need to create a Process for the disassembler, and there
  256. are no symbols in 'KeepASL'). The string gadget allows you to enter any CLI
  257. arguments to be passed to the executable file (again, not required now). So,
  258. just LMB on 'OK'.
  259.  
  260.     The executable will be loaded, and the disassembly window moved
  261. to it's start address. Note that marker 9 will be defined at the address -
  262. marker 9 is always defined at the start address of any loaded executable/
  263. binary/boot, etc. When you load a binary file, marker 8 will be defined at
  264. its end address, so if you were to save the binary file later, you could
  265. enter 'm9' for the save binary start address, and 'm8' for the end address.
  266.  
  267.     Next, if you haven't already done so, load the SysSymbol data for
  268. the following directories: DOS, EXEC, INTUITION. This is done by pressing the
  269. 'Help' key to access the 'Resident SysSymbol Data Preferences', selecting the
  270. required data, then 'Use'. This request also allows you to load and save the
  271. preferences, or to quit, which will restore the preferences to the state they
  272. were when you pressed 'Help'.
  273.  
  274.     In the disassembly window, you'll have something like this:
  275.  
  276. 0000665256        move.l    4.w,665604
  277. 0000665264        bsr.w    665504
  278. 0000665268        lea.l    665766(pc),a1
  279. 0000665272        moveq.l    #0,d0
  280. 0000665274        movea.l    665604(pc),a6
  281. 0000665278        jsr    -552(a6)
  282. 0000665282        move.l    d0,665608
  283. 0000665288        beq.w    665406
  284. 0000665292        lea.l    665784(pc),a1
  285. 0000665296        moveq.l    #0,d0
  286. 0000665298        movea.l    665604(pc),a6
  287. 0000665302        jsr    -552(a6)
  288. 0000665306        move.l    d0,665612
  289.  
  290. Obviously, the addresses will be different but the methods are the same.
  291.  
  292.     First of all, LMB on the area between the address and the mnem-
  293. onic of the first line, and enter the text 'main'. From the request window,
  294. select 'Instruction'. This will define a program symbol for the first address
  295. of the program, and will log the address as an instruction. Incidentally, if
  296. you ever enter a program symbol name which does not fit into the available
  297. area, the end of the name will not be lost. On the screen, only the first 11
  298. characters will be visible; when you disassemble to a file, the whole of the
  299. name will be output.
  300.  
  301.     Now, LMB on the destination effective address of the first line.
  302. This will open the symbol selection window (see below for specific info).
  303. Activate the string gadget which presently contains the LMB'd address, and
  304. enter the text 'sys_base'. From the request windows which open, you should
  305. define the address type as 'Variable', the address size as 'Long', and the
  306. address base as '+ Decimal'. What this does is to log the DEA of the first
  307. instruction as a long variable, the content of which will be displayed as
  308. positive (unsigned) denary. Just to make sure, RMB on the DEA of the first
  309. line, and you'll see:
  310.  
  311. 0000665604    sys_base    DC.L    0
  312.  
  313. The previous disassembly window address will have been stacked (look at the
  314. status message), so you can return there either by LMB on the third icon
  315. from the left at the top of the screen, or by pressing '0'. Do this now!
  316.  
  317.     You'll notice that as well as having replaced the DEA of the
  318. first line with the program symbol 'sys_base', Disect will also have replaced
  319. all other references to this address. This feature can be disabled by press-
  320. ing 'Del', and unchecking 'AutoSymbol', BUT DON'T DO THIS NOW!
  321.  
  322.     Now, to make the source more readable, we'll add a blank line
  323. after each of the following lines in the disassembly window: the first, the
  324. second, and the eighth line. Do this by LMB on the mnemonic of each of these
  325. lines. This will open the 'Address Functions' request, from which you should
  326. select 'Add Blank Line' (at lower-left of window). For the second and eighth
  327. lines, you'll get the 'Address Type' request, since these addresses have not
  328. yet been logged - obviously, these should be logged as instruction addresses.
  329. This will result in the following:
  330.  
  331. 0000665256    main    move.l    4.w,sys_base
  332.  
  333. 0000665264        bsr.w    665504
  334.  
  335. 0000665268        lea.l    665766(pc),a1
  336. 0000665272        moveq.l    #0,d0
  337. 0000665274        movea.l    sys_base(pc),a6
  338. 0000665278        jsr    -552(a6)
  339. 0000665282        move.l    d0,665608
  340. 0000665288        beq.w    665406
  341.  
  342. 0000665292        lea.l    665784(pc),a1
  343. 0000665296        moveq.l    #0,d0
  344.  
  345.     Next, LMB on the text '-552' (or -$228), then on the text 'exec'
  346. in the lower window. You'll probably have guessed already, but LMB on the
  347. text '_LVOOpenLibrary' in the upper window, then select 'Confirm', and define
  348. the address as 'Instruction'. Now, we all know that a call to exec.Open-
  349. Library() requires a1 pointing to the library name text, so RMB on the SEA of
  350. the third line. What you now see won't look like much, until you've done the
  351. following: define a program symbol at the first line in the disassembly
  352. window, 'name' will do, and define the address as Data/Byte/ASCII/0. Now
  353. we know what library it is, we can change the program symbol from 'name' to
  354. 'int_name':
  355.  
  356. 0000665766    int_name    DC.B    "intuition.library",0
  357.  
  358.     The last request window ('Select Data Area Size') allows you to
  359. define how many bytes there are in a data area in five ways: you can enter
  360. an expression to define the number of BYTES; you can simply press 'Enter' to
  361. make it consist of one byte, one word, or one long (depending on the address
  362. size already defined); you can select '0' to make the data area end at the
  363. first NULL byte/word/long; you can select '-1' (end at first -1 byte/word/
  364. long); or you can select 'Symbol' to make it end at the byte before the
  365. address of the next defined program symbol.
  366.  
  367.     If you now press '0', you'll see that the address reference will
  368. have been replaced with 'int_name'.
  369.  
  370.     Next, press the 'A' key, and enter the following: '[0:$58]'. This
  371. will move the disassembly window to the $58th byte of the first hunk. Here,
  372. you will see a 'jsr' as the third line. LMB on the text '-204' or '-$cc',
  373. and replace it with '_LVOOpenWindow'. So, the first line contains the address
  374. of a NewWindow structure, so RMB on this address to move the disassembly
  375. window to this data. Now press key 'X', (or select 'Define DataString' from
  376. the 'Functions' menu), and from the list of system DataStrings, LMB on the
  377. text 'NewWindow', then select the 'Define' gadget. The NewWindow structure
  378. data area will be logged, and Disect will inform you that it has found an
  379. address pointer within the NewWindow structure, which points to an ASCII
  380. string. Click on the 'Define' gadget, and the ASCII string will also be
  381. defined as a data area. The disassembly window will now be returned to the
  382. address of the NewWindow structure. For further information about DataStrings
  383. I STRONGLY recommend that you read section 7.
  384.  
  385.     Well, we could go on like this for all of the 560 bytes of the
  386. program, but fortunately, you don't have to. Instead, select 'Load DSCT Data
  387. File' from the project menu, 'Erase', then load the file 'KeepASL.dsct':
  388.  
  389.     ; * -------------------------------------------------------------
  390.  
  391.     ; Disassembly of 'KeepASL' - DMA 1.10.94
  392.  
  393. 0000665256    main    move.l    (EXEC_BASE).w,sys_base
  394.  
  395. 0000665264        bsr.w    start_up        ; WB/CLI start up
  396.  
  397. 0000665268        lea.l    int_name(pc),a1    ; open intuition
  398. 0000665272        moveq.l    #0,d0
  399. 0000665274        movea.l    sys_base(pc),a6
  400. 0000665278        jsr    _LVOOpenLibrary(a6)
  401.  
  402. Much better than the original, eh!
  403.  
  404.     Now, we're going to disassemble the whole program to source, so
  405. press 'd'. This gives the 'Disassemble To File' request. The disassembly
  406. address range will be initialised as the address range of the loaded program.
  407. Note that with executable files, there may be more than one hunk in the file,
  408. so it is possible to disassemble more than one address range. Now, using the
  409. two string gadgets at the bottom of the window, enter the two path/file names
  410. as 'RAM:Program.s' and 'RAM:Support.s', then select either to EQU or INCLUDE
  411. system constant symbols (I suggest EQU), and select 'OK'.
  412.  
  413.     After a short time a request window will open, informing you that
  414. an immediate long has been found. This means that Disect has found a number,
  415. as immediate data, which is within the project memory range. It is possible
  416. for such numbers to be immediate data, or program addresses, but it should
  417. be fairly obvious for you to decide which from the context in which they are
  418. used. For such numbers, Disect will display any matched program symbol name,
  419. or alternatively, the previous program symbol to the address along with the
  420. required offset to match the value of the number. From this request, you have
  421. a choice of leaving the number as immediate data, replacing the number with
  422. the symbol (or symbol+offset), or quitting the disassembly process.
  423.  
  424.     In our case, the number should be replaced (it's actually the
  425. nw_Title pointer of the NewWindow structure). Ok, when it's done, load up
  426. the two source files (you'll actually find them in the Tutorial drawer,
  427. although I suggest you DO have a go at all this). Have a look at them...
  428. Nice, aren't they! AND, they'll assemble correctly.
  429.  
  430. * ------------------------------------------------------------------------- *
  431.  
  432. 5) Symbol Selection Window
  433. ==========================
  434.  
  435.     A major feature of Disect is its ability to replace numbers
  436. present within a program with symbols. Disect can distinguish between two
  437. different types of symbols:
  438.  
  439. PROGRAM    A program symbol refers to a specific address within the program.
  440.     This may be either the destination of a branch, etc, or an access
  441.     to a variable, or the address of data.
  442.  
  443.     There are two kinds of program symbol, system and user. System
  444.     program symbols, or system address symbols, are used to refer to
  445.     absolute addresses in memory, for example, the addresses of chip
  446.     registers. These form part of Disect's predefined system symbol
  447.     list. User program symbols are defined by the user, and are used
  448.     to refer to addresses within the program being disassembled.
  449.  
  450. CONSTANT    A constant symbol refers to any number used as immediate data, or
  451.     as a displacement for the following addressing modes:
  452.  
  453.     ARID    dd(ax)        ARIDI    dd(ax,rx.x)
  454.     PCD    dd(pc)        PCDI    dd(pc,rx.x)
  455.  
  456.     Disect's predefined system symbol list includes all of the system
  457.     constants of Release 3.0 of the system include files. These are
  458.     divided into three classifications:
  459.  
  460.     LVO    a library vector offset used with: jsr dd(ax)
  461.     Structure    a system structure offset used with: dd(ax)
  462.     Constant    all other system symbols
  463.  
  464.     User constant symbols are defined by the user. There are three
  465. different types of these: normal constant symbols; constant symbols which
  466. represent offsets from a Process's variables-memory base address register
  467. ('variable constants'); and 'address constants'. Address constants are
  468. temporary symbols which make it easier to see what a Process is doing. For
  469. example, if a Process calls Inituition.OpenWindow(), on exit, d0 will point
  470. to the Window structure. Obviously, you cannot define a program symbol for
  471. this address (outside project memory), but if you were to then press the
  472. 'CTRL' key, and LMB on the 'd0' text in the register window, a request
  473. window will open into which you can enter a symbol name, eg: 'WINDOWP'.
  474. Now, whenever any register contains the address of this symbol, then this
  475. name will be displayed in the register window instead of the address.
  476.  
  477.     A valid symbol name must begin with either a letter, or the
  478. characters '_' or '.', and may continue with any of these, as well as digits.
  479. Disect supports the use of local program symbols, which must be prefixed
  480. with either a '_' or '.' character, depending upon the current preference
  481. setting. There are a certain number of reserved symbol names which cannot
  482. be used when defining a symbol. The list of these can be found in section 9.
  483.  
  484.     In order to replace a number within a program, all you have to
  485. do is LMB on the number in the disassembly window. This will open the Symbol
  486. Selection Window, which is used to specify which symbol(s) are to be used to
  487. replace the number. In addition to using real symbols, Disect also allows
  488. 'fake' symbols to be created. These are symbols which have no name text.
  489. Instead, the 'name' is the value of the symbol displayed in whatever base you
  490. select. For example, instead of replacing the number 16 with the real symbol
  491. 'MP_SIGTASK', you could replace it with the fake symbol '%10000'. Or, the
  492. number 65 may be replaced with a fake symbol: "A". The possible bases for
  493. fake symbols are decimal, hex, ASCII, binary. Such symbols will appear in
  494. the symbol list where appropriate.
  495.  
  496.     Whenever you replace a number, the address where the number
  497. occurs becomes logged in the usual way. In addition, if you are replacing
  498. an address with a (new, program) symbol, then this address is also logged.
  499. Consider the following:
  500.  
  501. 632472        move.l    632804,d0
  502.  
  503.     ~    ~    ~
  504.  
  505. 632804        ori.b    #0,d0
  506.  
  507. If you LMB on the '632804' in the first line, and replace it with a symbol,
  508. eg: 'variable', then the addresses of both lines will be logged. First,
  509. Disect will allow you to define the address type for the equivalent address
  510. of '632804' (although INCBIN is not supported in this way, at present). In
  511. this example, it might be address type: VARIABLE/LONG/... This will log the
  512. second address, and assign to it a program symbol (named 'variable'). After
  513. this, the Symbol Selection window will close, and Disect will then request
  514. the characteristics of the first address (INSTRUCTION).
  515.  
  516.     The Symbol Selection window contains two list windows. The left
  517. window will display the current list of matched symbols. You may select a
  518. symbol from the list by LMB on it within this window. The right window will
  519. display either a list of system include directories, or a list of the files
  520. within a selected directory. You can LMB on a directory or file name in order
  521. to limit the symbol search to only the selected directory or file. If you RMB
  522. on a system constant symbol (in the other list), then this will select the
  523. system include directory and file which contains that symbol. Note that if
  524. you RMB anywhere else (not in the symbol list window), then the current list
  525. of symbols will be sorted alphabetically.
  526.     The currently selected system include path is displayed above the
  527. includes list window; to the right of this text is a 'Parent' gadget to un-
  528. select the current directory and file names.
  529.  
  530.     In the symbol list window, if a symbol has a '*' character disp-
  531. layed after its name, then this denotes that the symbol is not defined in
  532. the official system includes. There are quite a few of these to allow greater
  533. flexibility. They include 'FLAGB_' and 'FLAGF_' definitions of 680x0 process-
  534. or flags (in exec/execbase.i), and a complete list of raw key codes (devices/
  535. keyboard.i), as well as some hardware bits symbols. When disassembly to file,
  536. any such symbols will be output to the support file as EQUs.
  537.  
  538.     Above the symbol list window, are four gadgets. The first two
  539. gadgets allow selection of the type of symbol to be searched for. The first
  540. gadget selects between System or User symbols; the second, between Program or
  541. Constant symbols.
  542.     The third gadget allows you to select the type of search to be
  543. performed; there are two possible types of symbol search: Value, and Bit.
  544. The first will search all resident symbols for a direct value match with the
  545. number to be replaced. A Bit search will list all symbols for which a set
  546. bit in the original number corresponds to a set bit in the symbol's value.
  547. This is used when replacing a number which represents bitwise OR of multiple
  548. bit flags. As examples:
  549.  
  550.         move.l    #IDCMP_RAWKEY+IDCMP_CLOSEWINDOW,(a0)
  551.  
  552.         move.w    #DMAF_MASTER+DMAF_COPPER,dmacon(a5)
  553.  
  554. When searching for symbols in this way, when you have selected the first
  555. symbol to be used, Disect will then only list symbols which represent bits
  556. in the same group of flags (eg: only IDCMP_ flags, or only DMAF_ flags).
  557.  
  558.     The fourth gadget depends on the current symbol type: for program
  559. symbols, a 'Prev' gadget will exist; for constant symbols, an Offset cycle
  560. gadget will exist.
  561.     The 'Prev' gadget will automatically select the system address or
  562. user program symbol with a value previous to that of the number being replace
  563. (which would be an address). This is useful for finding, for example, a ref-
  564. erence to the low byte of a word variable (assuming you have already defined
  565. a program symbol for the address of the word), or a reference into a data
  566. table. It becomes especially useful if replacing a system address: for any
  567. direct address reference to a hardware register, pressing this gadget will
  568. result in the symbol 'CUSTOM_BASE' being automatically selected (ie: address
  569. $DFF000). The apprioriate symbol from the hardware directory (custom.i) can
  570. then be selected to account for the required offset to the actual address.
  571. When you attempt to find a previous (user) program symbol, Disect will only
  572. use a local program symbol if this does not result in a reference to a local
  573. program symbol across the bounds of a global program symbol.
  574.  
  575.     When searching for system/user constant symbols, the Offset cycle
  576. gadget will be displayed. This allows you to select an offset value to be
  577. used when searching for a symbol value match. The possible offsets are:
  578. -1, -2, -3, +1, +8, +16, +24. Such an offset represents the value to be added
  579. to the original search value in order to find the value to which the symbol
  580. search must match symbols. For example:
  581.  
  582.         btst.b    #INTB_AUD3,intreqr(a5)
  583.  
  584. Now, INTB_AUD3 has the value 10, ie: bit 10 of the word-register. When this
  585. is assembled (some assemblers would allow the above, some would require you
  586. to have '-8' after the 'INTB_AUD3'), the resulting code would actually be:
  587.  
  588.         btst.b    #2,$1E(a5)
  589.  
  590. So, when you LMB on the '2' in the disassembly window, obviously Disect would
  591. search for symbols of value 2. If you've already replaced the '$1E' with
  592. 'intreqr', then you'll be expecting an 'INTB_' symbol. This would return
  593. 'INTB_SOFT'. Incorrect. Hence, an offset of '+8' will solve the problem, and
  594. produce the relevant result (by searching for symbols of value 2+8, hence
  595. 'INTB_AUD3' would be found!). The actual result would, of course, be:
  596.  
  597.         btst.b    #INTB_AUD3-8,intreqr(a5)
  598.  
  599.     Above the four symbol gadgets is a string gadget. This has a dual
  600. purpose of displaying the currently selected list of symbols which will be
  601. used to replace the number, and to allow a symbol name to be input. When
  602. searching for user program or constant symbols, you may enter any valid
  603. unused symbol name here, and this will be created as a new user symbol which
  604. will be assigned the value of the replace-number.
  605.     If you enter the name of an existing system/user symbol, then
  606. this will have the effect of selecting the symbol. In this case, the symbol
  607. search value (ie: originally the number which was being replaced), will be
  608. adjusted to take account of the value of the symbol which you entered. This
  609. is useful since there are times when a number being replaced is formed from,
  610. for example, an accumulation of structure offsets. As an example, consider a
  611. program which allocated it's variables memory dynamically, then accessed them
  612. using ARID mode via a5. Supposing this memory block was 2k in size, and you
  613. have determined that bytes 240 to 273 are used for an MP structure (message
  614. port, exec/ports.i), so you have defined a user constant symbol 'mport' to
  615. have the value 240. Now, you might find the following:
  616.  
  617.         move.b    255(a5),d0
  618.  
  619. What this represents is in fact:
  620.  
  621.         move.b    mport+MP_SIGBIT(a5),d0
  622.  
  623. This can be achieved by entering the name 'mport' (which will be selected,
  624. and the search value of 255 adjusted to 15), then selecting the 'MP_SIGBIT'
  625. symbol by LMB in the symbol list window.
  626.  
  627.     To the right of the string gadget are three check gadgets which
  628. are used to select the type of symbols to be searched for when searching for
  629. system constant symbols. These gadgets will automatically define themselves
  630. according to the context where the replace-number was used. Note that this
  631. cannot be 100% accurate for the type of symbols: always make sure you are
  632. searching for what you want!
  633.  
  634.     Whenever a symbol is selected which results in the search value
  635. becoming zero, then a request window will open. The content of this varies.
  636. If you are making a normal symbol selection (due to LMB in the disassembly
  637. window), then four gadgets will exist: 'New' 'Zero' 'Confirm' and 'Quit'.
  638. When making a dummy symbol selection (due to pressing the 'P' key in the main
  639. window), then a 'Comment' gadget will exist instead of 'Confirm'. If you are
  640. replacing a number within a bitfield instruction (ie: either the offset or
  641. width value), then you get 'New' 'Confirm' and 'Quit'.
  642.     The 'New' gadget will erase the currently selected symbol(s) and
  643. allow a new seclection to be made. 'Zero' will allow you to select further
  644. symbols (of value 0). 'Confirm' will cause the original number in the disass-
  645. embly window to be replaced with the currently selected symbol(s). 'Quit'
  646. will abort, and close the Symbol Selection window. The 'Comment' gadget has
  647. a rather useful purpose (see key 'P' in section 12).
  648.  
  649. * ------------------------------------------------------------------------- *
  650.  
  651. 6) Address Functions
  652. ====================
  653.  
  654.     The Address Functions request is accessed via LMB on the opcode
  655. (mnemonic) area in the disassembly window. The address functions are as
  656. follows:
  657.  
  658. Log Address
  659. -----------
  660.  
  661.     This allows a program address to be logged. You will be requested
  662. the type of the address. This may be instruction, variable, data, copper,
  663. INCBIN, ASCII string (NULL-terminated), or EVEN string (which is the same,
  664. except Disect will ensure that the string ends at an odd address, so that
  665. the next address is therefore even). Note that any extra pad byte used to
  666. word-align the string must be NULL. If a Process exists, then when an address
  667. is logged (by any method), if the PC is at the address, then it will be auto-
  668. matically defined as an instruction address.
  669.  
  670. INSTRUCTION    This is the default address type for all addresses at which the
  671.     opcode can be successfully identified as a valid instruction.
  672.  
  673. VARIABLE    This allows an address to be defined as a byte, word, or long
  674.     variable. The base in which the variable's value should be
  675.     displayed can also be defined.
  676.  
  677. DATA    Similar to a variable address, a data address consists of any
  678.     number of bytes, words, or longs. The size of the data area can
  679.     be specified by either: pressing Enter (for 1 byte/word/long);
  680.     inputting an expression to determine the number of bytes of data;
  681.     selecting the '0' or '-1' gadget (data continues up to & includ-
  682.     ing the first 0 or -1 byte/word/long); or selecting the 'Symbol'
  683.     gadget (data area continues until next defined program symbol).
  684.     Incidentally, there is another way of defining data areas. See
  685.     section 7.
  686.  
  687. COPPER    A copper address will be disassembled as a macro which, when
  688.     assembled, will create the relevant copper instruction. These
  689.     macros will be output to the support source file during file
  690.     disassembly (if required). Note that for copper move instruction,
  691.     if the hardware SysSymbol data is resident then the move destin-
  692.     ation address will automatically be replaced with the relevant
  693.     symbol for the hardware register it refers to.
  694.  
  695. INCBIN    This allows data areas to be defined as INCBIN areas. Such areas
  696.     will be disassembled as an INCBIN directive. Upon selection of
  697.     this, Disect will request the INCBIN data area size. After this,
  698.     the ASL is used to select the file to which the data area should
  699.     be written. See also the section about the INCBIN request window.
  700.  
  701. ASCII    The data area will be defined as an ascii string, terminated by
  702.     a NULL byte, or a byte of value -1.
  703.  
  704. EVEN STRING    As ASCII, but is guaranteed to be of even length.
  705.  
  706. AS PREVIOUS    This will automatically define an address of the same type, etc,
  707.     as the previously defined address. Be careful not to use this
  708.     after, for example, defining an address via the Symbol Selection
  709.     Window, since this would be taken as the previous address type.
  710.  
  711. Amend Address
  712. -------------
  713.  
  714.     This allows a previously-logged address to be amended.
  715.  
  716. Erase Address
  717. -------------
  718.  
  719.     This will remove anything that has been attached to the address.
  720.  
  721. Add/Erase Section Header
  722. ------------------------
  723.  
  724.     A section header is a line of '-' characters, which will be added
  725. before the address.
  726.  
  727. Add/Erase Header Comment
  728. ------------------------
  729.  
  730.     These options allow a full-line comment to be added before the
  731. address, or to be removed from the address. You can also LMB on an existing
  732. comment text to edit it.
  733.  
  734. Add/Erase Line Comment
  735. ----------------------
  736.  
  737.     These allow an end-of-line comment to be added to the address,
  738. or removed from the address. You can also LMB in the line comment text area
  739. to add a comment, or to edit an existing comment.
  740.  
  741. Add/Erase Blank Line
  742. --------------------
  743.  
  744.     These will add/remove a blank line after the address.
  745.  
  746. Erase Program Symbol
  747. --------------------
  748.  
  749.     This allows a program symbol to be removed from the address.
  750.  
  751. Erase SEA Symbols
  752. -----------------
  753.  
  754.     This option will remove any symbol(s) which have been used to
  755. replace the instruction's source effective address. This includes the offset
  756. and width values for 68020 bit fields.
  757.  
  758. Erase DEA Symbols
  759. -----------------
  760.  
  761.     This option will remove any symbol(s) which have been used to
  762. replace the instruction's destination effective address. This includes the
  763. offset and width values for 68020 bit fields.
  764.  
  765. * ------------------------------------------------------------------------- *
  766.  
  767. 7) DataStrings
  768. ==============
  769.  
  770.     In order to log a data area which consists of a number of byte/
  771. word/long elements, ie: all bytes, all words, OR all longs, you use the
  772. address functions request. This allows you to specify the total size of the
  773. data area, and Disect will log only the first address. Obviously, this can
  774. save a lot of memory for large data areas, since Disect does not have to
  775. store information for each address. This is the best way of logging uniform
  776. data areas.
  777.  
  778.     For any data area where its elements are not all the same size
  779. (byte/word/long), you can use a DataString. The DataString request, accessed
  780. via key 'X', allows you to define your own DataString, or select a system
  781. DataString, and use it to define a data area.
  782.  
  783.     A DataString consists of two strings: the format string, and the
  784. base string. The first specifies the size of each element of a data area;
  785. 'B' represents a byte, 'W' a word, and 'L' a long. The base string defines
  786. the base of a 'piece' of data: 'P' positive denary; 'N' negative denary;
  787. 'H' hex; 'B' binary; 'A' ASCII; 'X' means use the currently selected default
  788. base (either hex or denary, as defined via the preferences). When you use
  789. a DataString to define a data area, successive addresses are logged as data,
  790. the size and base of which corresponds to the relevant characters from the
  791. format and base strings.
  792.  
  793.     Disect contains a number of predefined (system) DataStrings. The
  794. names of these correspond to the names of system structures, eg: Gadget, New-
  795. Window, etc. Each DataString represents the byte/word/long elements of the
  796. relevant system structure. You can also define your own DataStrings, which
  797. will be saved/loaded as part of the Disect data file. In the DataString
  798. request window, after pressing Enter in the base string gadget, if your
  799. DataString is valid, then it will be automatically stored. The LMB can be
  800. used to select a DataString from the currently displayed list.
  801.  
  802.     As of V1.6, when you use a system DataString to define a data
  803. area, a preference exists to allow Disect to automatically add a line comment
  804. to each 'DC.X' directive. These comments will be the names of the fields of
  805. the system structure which the DataString represents.
  806.     When you later LMB on the operand of such a 'DC.X' directive (in
  807. order to replace it with a symbol) then Disect actually uses the line comment
  808. text in order to define which system include file is to be searched within
  809. the Symbol Select window. If the required directory's SysSymbol data is not
  810. resident, Disect will attempt to load it. As well as automatically selecting
  811. which include file, Disect also defines which 'group' of bit symbols should
  812. be listed, if necessary. For example, if you LMB on the number of:
  813.  
  814.     DC.W    $44040        ; nw_IDCMPFlags
  815.  
  816. then the Symbol Select window will open in 'intuition/intuition.i', and only
  817. 'IDCMP_' flag symbols will be listed! If required, once such a number has
  818. been replaced with a symbol, Disect will automatically erase the line comment
  819. text since it is no longer required. This is a preference, and can therefore
  820. be disabled if necessary. In addition, an item exists in the 'Functions'
  821. menu which will erase ALL existing SDS (system DataString) line comments.
  822.  
  823.     When defining an data area using a system DataString, Disect can
  824. detect pointers to other system structures. For example, within a NewWindow
  825. structure, nw_FirstGadget will be detected as pointing to a Gadget structure.
  826. In this case, Disect will move the disassembly window to the address of the
  827. Gadget structure, and a request window will open which allows you to confirm
  828. to Disect that you wish the data area to be defined, or alternatively, you
  829. can cancel the definition.
  830.     The window also contains a string gadget, which will contain
  831. either the text of any existing program symbol at the start of the data area,
  832. or a symbol name which Disect will create automatically. Whichever, this is
  833. the symbol name which will be defined for the first address of the data area.
  834. It is not possible to enter any other program symbol name. For example, for a
  835. Gadget structure, Disect may create a program symbol of 'gadget0'. The number
  836. at the end of the symbol name is defined to be unique for each data area
  837. definition. It is recommended that you use these automatic symbol names
  838. (see below).
  839.     Whenever a data area is defined in this way (due to a pointer to
  840. it within a previously-defined data area), then the program symbol of it is
  841. used to replace the number/address within the existing data area. Example:
  842.  
  843.     DC.L    gadget0        ; nw_FirstGadget
  844.      ~       ~
  845.      ~       ~
  846.      ~       ~
  847. gadget0    DC.L    $13ef26        ; gg_NextGadget
  848.  
  849.     Two of the system structures which are supported by DataStrings
  850. exist as an array of structures. These are TagItem and NewMenu structures.
  851. When you define a data area for either of these structures, Disect will also
  852. define any following structures, until the end of the array. For example,
  853. a TagItem array ends when ti_Tag holds a value of TAG_END.
  854.  
  855.     One last point to mention is that when a data area is defined via
  856. a system DataString (directly from the request window, as opposed to via a
  857. pointer to it in a previously-defined data area), if the first address of the
  858. area does not have a program symbol, then Disect will automatically create
  859. one for the address, as described above. The thing to be aware of is that
  860. when disassembling to a source file, Disect has the ability to detect such
  861. program symbols, and if it does so, it will disassemble the data area using
  862. a single macro (instead of a sequence of DC.X directives). For example:
  863.  
  864. gadget1    DC.L    gadget2
  865.     DC.W    326,4,50,14
  866.     DC.W    GFLG_GADGHCOMP,GACT_RELVERIFY,GTYP_BOOLGADGET
  867.     DC.L    border12,0,intuitxt7,0,0
  868.     DC.W    2
  869.     DC.L    0
  870.  
  871. The above would automatically be converted to:
  872.  
  873. gadget1    GADGET    gadget2,326,4,50,14,GFLG_GADGHCOMP,GACT_RELVERIFY,
  874. &        GTYP_BOOLGADGET,border12,0,intuitxt7,0,0,2,0
  875.  
  876. This will not occur: if any address in the data area has a line end comment;
  877. if any address in the data area other than the first address has either a
  878. header comment, or a program symbol; or if you have not used Disect's auto-
  879. matic symbol names. The syntax for continuing macro parameters over more than
  880. one line follows that required by Devpac. Any required macro definitions
  881. will be output to the Support source file.
  882.  
  883.     As a result of this feature, any program symbol name which might
  884. be created by Disect is now reserved; this means that you cannot use these
  885. names for any other program symbols you might create. The complete list of
  886. reserved symbol names (and macro names) can be found in section 9.
  887.  
  888.     The DataString request window contains the following:
  889.  
  890. Data Start Address
  891. ------------------
  892.  
  893.     A string gadget allows the data start address to be specified.
  894. This will be initialised, when the window opens, to be the start address of
  895. the (upper) disassembly window.
  896.  
  897. DataString Name
  898. ---------------
  899.  
  900.     A string gadget is used to enter the name of a user DataString.
  901. If you enter the name of an existing DataString, it will be selected.
  902.  
  903. Data Format String
  904. ------------------
  905.  
  906.     This string gadget allows you to enter up to 512 characters to
  907. specify the format of the data area. Each data element may be specified to
  908. be byte, word, or long, by entering the characters 'B', 'W', or 'L'. Note
  909. that if you enter, for example, 'LLBBBW', then Disect will automatically
  910. insert an extra 'B' before the 'W' to ensure word-alignment. Disect will
  911. permit an odd number of 'B' if it is at the end of the string.
  912.  
  913. Data Base String
  914. ----------------
  915.  
  916.     This string is used to enter an equal number of characters to
  917. specify the base of each data element. Each may be any of: 'P' positive den-
  918. ary; 'N' negative denary; 'H' hex; 'B' binary; or 'A' ASCII.
  919.  
  920.     Associated with each string are two numbers. The first displays
  921. the number of characters for each string. The second displays the number of
  922. successive, same, characters at the end of each string.
  923.  
  924. System/User Cycle
  925. -----------------
  926.  
  927.     This will toggle between a list of system and user DataStrings.
  928.  
  929. Delete
  930. ------
  931.  
  932.     This will delete the currently-selected user DataString.
  933.  
  934. Define
  935. ------
  936.  
  937.     This will close the window, and cause Disect to attempt to define
  938. the data area using the selected DataString. If an error occurs, the disass-
  939. embly window will be moved to the address which Disect was attempting to log
  940. when the error ocurred. Where possible, Disect will preserve any existing
  941. program symbols and comment texts within the definition data area. Any blank
  942. lines will be removed, but one will be added at the end of the data area.
  943.  
  944. Quit
  945. ----
  946.  
  947.     This will close the window, without defining the data area.
  948.  
  949. * ------------------------------------------------------------------------- *
  950.  
  951. 8) Key Macros
  952. =============
  953.  
  954.     The 'Macros' menu allows up to ten key macros to be defined and
  955. used. This allows sequences of key presses, LMB or RMB clicks, and gadget
  956. and menu selections to be recorded, and played back automatically by pressing
  957. a single key. As an example of just how useful this can be, supposing you
  958. were dissecting a program which contained a data table of, say, a hundred
  959. entries, each one consisting of the following sort of thing:
  960.  
  961.     DC.B    "some text string",0,0
  962.     DC.L    program_function67
  963.  
  964. Before this has been logged as data, it might be disassembled as, for
  965. example:
  966.  
  967. $42be8    DC.W    $736f
  968. $42bea    blt.b    $42c51
  969. $42bec    DC.W    $2074
  970. $42bec    bcs.b    $42c68
  971.       ~       ~
  972.       ~       ~ etc
  973.  
  974. To define a key macro to format a single entry, first of all you would make
  975. sure that the disassembly window is at the start address of the first entry.
  976. You then begin the macro definition by selecting the menu item 'Macros/Begin
  977. Definition/Macro 1'. First, by LMB on the first 'DC.W', you would define the
  978. address as an 'EVEN String'. This gives:
  979.  
  980. $42be8    DC.B    "some text string",$0,$0
  981. $42bfa    ori.b    #$0,-(a0)
  982.  
  983. Next, LMB on the 'ori.b', then select 'Add Blank Line', and define this
  984. address as a single 'Data/Long/Hex' long. Finally, by clicking on the
  985. disassambly window down arrow twice, then pressing 'Enter', the macro will
  986. be defined. By moving the disassembly window down two lines, you will ensure
  987. that each time you use the macro, the relevant addresses will be formatted,
  988. since the macro has been defined to operate upon the first two lines in the
  989. disassembly window. All that is now required is to press the '1' key to use
  990. the macro to define successive entries in the data table, until the end of
  991. table is reached.
  992.  
  993.     During definition or playback of any macro, if any errors occur,
  994. then the macro definition/playback will be aborted. This would result in a
  995. macro NOT being defined. This also occurs if any Process exception occurs;
  996. this includes trace and breakpoint exceptions: macros are not compatible
  997. with Process execution.
  998.  
  999.     Remember! When defining a key macro, you must always press Enter
  1000. for all string gadgets which you use!
  1001.  
  1002.     A defined macro can be replayed either by pressing it's key
  1003. (F1-F10), or using the menu item. Via the menu item, a request window will
  1004. open which allows you to specify either to play the macro once, to play the
  1005. macro a specific number of times, or to play the macro until an expression
  1006. is TRUE. This is probably most useful for something such as the following:
  1007. 'w1=$662084', which would play the macro until the (upper) disassembly
  1008. window reached a certain address.
  1009.  
  1010.     Macro playback can be aborted by clicking on the main program
  1011. window, and pressing Escape.
  1012.  
  1013. * ------------------------------------------------------------------------- *
  1014.  
  1015. 9) Expressions
  1016. ==============
  1017.  
  1018.     Disect allows complex expressions to be input whenever a numeric
  1019. value is required. Such expressions may contain program or constant symbols,
  1020. which may be system or user symbols, although local program symbols are not
  1021. permitted. Numbers may be expressed as denary, hex, binary, or character
  1022. constants (eg: 'a', "ab", 'abc', "abcd"). In addition, addresses can be
  1023. represented as offsets from hunk/project memory starts. For example, the
  1024. text "[0:16]" represents the address of the 16th byte of hunk 0 (the first
  1025. hunk). If there is only one project memory area (eg: an executable of only
  1026. 1 hunk, or a binary file, has been loaded), then a hunk number does not have
  1027. to be specified ("[16]" would be accepted). Any numbers within the "[]"
  1028. characters may be either hex or decimal. If a base offset address has been
  1029. defined, then if you were to input "[16]", then this would be taken as an
  1030. offset from the base offset address (instead of as an offset from the start
  1031. of the first/only hunk).
  1032.     It is also possible to prefix a number with a '.', for example:
  1033. '.$80000046'. This will cause Disect to treat the number as an FFP value,
  1034. which in this case would be evaluated to a value of 32. If the value is too
  1035. large/small to be stored as a long integer, then an error will result.
  1036.  
  1037.     Disect supports the following operators, in decreasing order of
  1038. precedence:
  1039.  
  1040. HIGH PREC    -        MINUS, eg: -32
  1041.     ~        bitwise NOT, eg: ~$0FF0
  1042.     << >>        SHIFT LEFT and RIGHT, eg: %1<<16
  1043.     & ! ^        bitwise AND, OR, EOR
  1044.     * / \        MULTIPY, DIVIDE, MODULO
  1045.     + -        ADD, SUBTRACT
  1046.     = < > <> <= >=    comparisons
  1047.  
  1048.     Precedence may be overridden via parentheses ( and ). Expressions
  1049. are evaluated left-to-right. Byte, word, and long indirection is supported
  1050. via parentheses:
  1051.  
  1052.     {4}.l        long content of address 4
  1053.  
  1054. The following is also possible:
  1055.  
  1056.     {{4}.l}.w        word content of address specified by
  1057.             long content of address 4
  1058.  
  1059.     The comparison operators return the value 0 if FALSE, and -1 (or
  1060. $FFFFFFFF) if TRUE. Expression evalution occurs using 32-bit unsigned integer
  1061. arithmetic. The operator | is equivalent to ! (bitwise OR); != may be used
  1062. for <> (inequality).
  1063.  
  1064.     There also exists a number of reserved symbol names. Unlike all
  1065. other symbols, they are case-insensitive:
  1066.  
  1067.     M1-M9    disassembly window markers 1-9
  1068.  
  1069.     W1    start address of upper/single disassembly window
  1070.     W2    start address of lower disassembly window
  1071.     W3    start address of memory window
  1072.  
  1073. If any address register is equal to any of these, then the relevant name
  1074. will be displayed in the register window instead of the actual address:
  1075.  
  1076.     BASEEXEC    Exec library base address
  1077.     BASEDOS    DOS library base address
  1078.     BASEGFX    Graphics library base address
  1079.     BASEINT    Intuition library base address
  1080.     BASEASL    ASL library base address
  1081.     BASEGADT    GadTools library base address
  1082.     BASEMFFP    MathFFP library base address
  1083.  
  1084. The following are only valid if a Process exists:
  1085.  
  1086.     D0-D7    current value of data registers
  1087.     A0-A7    current value of address registers
  1088.     PC    current value of program counter
  1089.     SR    current value of status register
  1090.     CCR    current value of condition codes register
  1091.     SP    current value of a7
  1092.     SEA    source effective address of instruction at PC
  1093.     DEA    destination effective address of instruction at PC
  1094.  
  1095.     INITSP    value of a7 when Process initially entered
  1096.     PROCP    address of Process's Process structure
  1097.  
  1098. If the trackdisk device has been opened (via the Functions menu), then the
  1099. following symbol name will evaluate to the address of the IOExtTD structure:
  1100.  
  1101.     IOEXTTDP
  1102.  
  1103. In addition, Disect will not allow symbol names such as 'A235768', or
  1104. 'a23ff40', since such names may be automatically created during disassembly
  1105. to file, and hence should not exist already.
  1106.  
  1107.     The following lists all the symbol names reserved for creation
  1108. of automatic program symbols for system structure data areas which have been
  1109. defined via DataStrings. Each symbol name is the base name to which an ascii
  1110. number is added. All possibilities (actually, an infinite number) of each
  1111. base name text are reserved. The macro name is the name of the macro which
  1112. is used to disassemble the whole data area during disassemble to file (note:
  1113. macros are used only if the program symbol at the start of the data area has
  1114. not been changed since the data area was defined).
  1115.  
  1116. System Structure    Base Symbol        Macro Name
  1117. ----------------    -----------        ----------
  1118.  
  1119. BB        bblock        BOOTBLOCK
  1120. BitMap        bitmap        BITMAP
  1121. BoolInfo        boolinfo        BOOLINFO
  1122. Border        border        BORDER
  1123. ColorSpec        colrspec        COLORSPEC
  1124. EasyStruct        easystru        EASYSTRUCT
  1125. ExtGadget        extgadg        EXTGADGET
  1126. ExtNewScreen    extnscrn        EXTNSCREEN
  1127. ExtNewWindow    extnwind        EXTNWINDOW
  1128. Gadget        gadget        GADGET
  1129. Hook        hook        HOOK
  1130. Image        image        IMAGE
  1131. IntuiText        intuitxt        INTUITEXT
  1132. KeyMap        keymap        KEYMAP
  1133. LH        listhead        LISTHEAD
  1134. LIB        lib        LIBRARY
  1135. LN        listnode        LISTNODE
  1136. MC        memchunk        MEMCHUNK
  1137. ME        mementry        MEMENTRY
  1138. MH        memheadr        MEMHEADER
  1139. ML        memlist        MEMLIST
  1140. MLH        minlisth        MINLISTHEAD
  1141. MLN        minlistn        MINLISTNODE
  1142. MN        message        MESSAGE
  1143. MP        messport        MESSAGEPORT
  1144. Menu        menu        MENU
  1145. MenuItem        menuitem        MENUITEM
  1146. NewGadget        newgadg        NEWGADGET
  1147. NewMenu        newmenu        NEWMENU
  1148. NewScreen        newscrn        NEWSCREEN
  1149. NewWindow        newwind        NEWWINDOW
  1150. Process        process        PROCESS
  1151. PropInfo        propinfo        PROPINFO
  1152. StringExtend    strextnd        STREXTEND
  1153. StringInfo        strinfo        STRINFO
  1154. TTextAttr        ttxtattr        TAGTEXTATTR
  1155. TagItem        tagitem        TAGITEM
  1156. Task        task        TASK
  1157. TextAttr        textattr        TEXTATTR
  1158. TextFont        textfont        TEXTFONT
  1159. TextFontExtension    tfontext        TEXTFONTEXT
  1160.  
  1161. * ------------------------------------------------------------------------- *
  1162.  
  1163. 10) MultiBin Files
  1164. ==================
  1165.  
  1166.     The 'Save MultiBin' item in the 'Project' menu allows a single
  1167. binary file to be created which consists of more than one block of memory.
  1168. The item will open a request window which contains a list of entered address
  1169. ranges, string gadgets for entering address ranges, and a couple of gadgets
  1170. at the bottom of the window.
  1171.     The 'SegList' gadget allows a memory-resident SegList to be
  1172. used to automatically define the address ranges to be saved. By entering
  1173. the start address of the first hunk in memory into the string gadget next
  1174. to the 'SegList' gadget, and then clicking on the 'SegList' gadget, Disect
  1175. will scan the SegList, and store the start and end addresses of each hunk
  1176. in the SegList. Be careful! The address to be entered as the start address
  1177. of the first hunk should be the address at which the PC begins when the
  1178. SegList is executed (the SegList is immediately before this address in
  1179. memory). Note that using the seglist gadget will cause the two longs before
  1180. each hunk to be saved in the MultiBin file. Whenever you save a MultiBin by
  1181. entering the address ranges yourself, do not forget to account for these
  1182. longs (since they may be referenced by the Process). (Incidentally, does
  1183. anyone know exactly what system structure pr_SegList is supposed to point
  1184. to? - I've written code myself which reads this 'structure', and it works
  1185. fine, but I'd really like to know. Maybe with Commodore out of the way, we
  1186. might see adequate system documentation in future?)
  1187.     There is also a check gadget which will force the file which is
  1188. saved to be pure binary. In general, if you have used the 'SegList' gadget,
  1189. then this should be unchecked, since extra information is saved in the file
  1190. which enables the MultiBin file ('.mbin') to be reloaded later to the same
  1191. addresses from which each block of memory was saved, and possibly created as
  1192. a Process. This is of most use when dissecting an executable which allocates
  1193. memory, into which it decompresses the real program as a complete SegList.
  1194. By specifying the initial execution address of the first decompressed hunk,
  1195. the complete program can be saved as a MultiBin file.
  1196.     If the gadget is checked, then only the exact content of the
  1197. specified memory ranges is saved, as a binary file ('.bin'). This means that
  1198. the saved memory cannot be loaded back later to the exact addresses from
  1199. which each block was saved.
  1200.  
  1201.     The 'Load MultiBin' item in the Project menu allows a previously
  1202. saved MultiBin file to be loaded. This presents a request window which has
  1203. an 'Allocate Saved Memory' check gadget. If checked, then Disect will attempt
  1204. to load the MultiBin file to the exact addresses from which it was saved.
  1205. Alternatively, if unchecked, the file will be loaded to any available memory.
  1206.     A separate executable program called 'AllocMultiBin' allows the
  1207. required memory of a MultiBin file to be allocated. It should be used immed-
  1208. iately after re-booting your machine. It will open an ASL requester with
  1209. which you specify the MultiBin file to be loaded. If an error occurs, the
  1210. program will re-open this requester; if the file loads successfully, the
  1211. program will merely wait until you click on it's window's close gadget, and
  1212. will then free the memory used by the MultiBin file (although normally you
  1213. would NOT do this).
  1214.     Once the MultiBin file has been loaded, you should leave 'AMB'
  1215. in memory, and load Disect. Then select 'Load MultiBin' from the 'Project'
  1216. menu, select the same MultiBin file as was loaded by 'AMB', and check the
  1217. 'Allocate Saved Memory' gadget in the relevant request window. From this
  1218. window, click on the 'OK' gadget, and 'AMB' will automatically free the used
  1219. memory, then terminate, allowing Disect to load the MultiBin file to the
  1220. required memory.
  1221.  
  1222.     Also in the Save Multibin request window is an 'Add' gadget,
  1223. which will attempt to add a selected address range to the current project,
  1224. if the memory is available.
  1225.  
  1226.     As of V1.8, Disect allows a single MultiBin 'file' to consist
  1227. of more than one file, across a number of disks. This is governed by the
  1228. preference 'Max MultiBin Size'. This is only needed by floppy disk users,
  1229. (me!) since it is possible to require MultiBin files of more than 800k.
  1230. This preference is only a general limit, since Disect will not split user-
  1231. defined memory areas.
  1232.  
  1233.     In addition, it is also now possible to save the state of your
  1234. Process in a MultiBin file. This is used when dissecting games (ie: anything
  1235. which does not use the OS), since obviously any opened windows,etc cannot
  1236. be saved. Disect will save the current registers (d0-d7/a0-a7/pc/sr), the
  1237. state of the hardware monitor (without the Pre-/Post-Execute functions),
  1238. and the Process's stack. One thing to be aware of is that if the Process's
  1239. stack top address has been defined (see the section on the Hardware Monitor),
  1240. then the stack memory is not saved, since this memory will already be part
  1241. of the project memory.
  1242.     One further thing, which I discovered for myself thinking it was
  1243. a bug! If you change the value of a7 (by LMB on its address digits in the
  1244. register window) and then save a MultiBin file, when this is re-loaded, a7
  1245. will still contain the previous value. To get the new value 'registered',
  1246. it is necessary to execute/trace an instruction first. This only applies to
  1247. a7, and no other registers.
  1248.  
  1249. * ------------------------------------------------------------------------- *
  1250.  
  1251. 11) Screen Icons Reference
  1252. ==========================
  1253.  
  1254.     Here is information about the icons at the top of the main
  1255. program screen, from left to right across it.
  1256.  
  1257. Unused Icon
  1258. -----------
  1259.  
  1260.     This icon is not used at present.
  1261.  
  1262. Auto-Data Icon
  1263. --------------
  1264.  
  1265.     This is a 'cycle' gadget which will be in one of five states: '-',
  1266. 'B', 'W', 'L', or 'I'. When '-', its function is disabled. If set to one of
  1267. 'B'/'W'/'L', by LMB on the mnemonic of an instruction in the disassembly
  1268. window, Disect will automatically define the relevant address as data (a
  1269. single DC.X), which will be either Byte, Word, or Long. The base of the
  1270. operand will be that which is currently selected (hex, or decimal).
  1271.     If set to 'I', then any addresses logged by, for example, adding
  1272. a blank line, will automatically be defined as Instructions.
  1273.  
  1274. Address Stack Icons
  1275. -------------------
  1276.  
  1277.     The address stack is used in order to follow the flow of a prog-
  1278. ram. If the RMB is pressed over an address in the disassembly window, the
  1279. current window start address will be stacked, and the disassembly window will
  1280. be moved to the new address. The three icons are: retrieve last stacked
  1281. address, stack current disassembly window address, and delete last stacked
  1282. address. Note that if pressing left alt while RMB, the lower disassembly
  1283. window address will be stacked/changed.
  1284.  
  1285. INCBIN Icon
  1286. -----------
  1287.  
  1288.     This icon will access the INCBIN request. This allows you to
  1289. define data areas which are to be disassembled using an INCBIN assembler
  1290. directive. In order to define an area, you simply enter the start and end
  1291. addresses of the area, and, if these are valid, Disect will then ask you to
  1292. select the file to save the binary area as. If the file is written ok, then
  1293. the INCBIN area will be defined.
  1294.     You can select an existing INCBIN area by LMB in the address
  1295. ranges list window. In order to delete an INCBIN area, you select it, then
  1296. enter NULL strings for the start and end addresses (ie: empty the string
  1297. gadget, and press 'Enter'). An INCBIN area may be unselected by pressing
  1298. the RMB.
  1299.     The 'Save' gadget is used in order to re-save, or rename, an
  1300. existing INCBIN area's binary file. This is only achieved by selecting
  1301. an INCBIN area first.
  1302.  
  1303.     The 'ILBM' gadget will open the ILBM request window. This allows
  1304. a selected INCBIN area to be saved as an IFF ILBM file. The window contains
  1305. two string gadgets to allow the size of the ILBM to be specified in pixels,
  1306. a cycle gadget to select the depth of the ILBM (up to 6 bitplanes), two check
  1307. gadgets to select the view modes (hi-res/interlace), and six bitplane-select
  1308. gadgets. These are used to select which bitplanes a selected INCBIN area
  1309. contains. You can either specify that the INCBIN area contains a single
  1310. bitplane, in which case you would click on the relevant bitplane gadget.
  1311. Alternatively, you can specify that the INCBIN contains all of the required
  1312. bitplanes as defined by the currently selected ILBM depth. In this case, you
  1313. merely click on the 'All Planes' gadget at the bottom of the window. When
  1314. a bitplane has been defined, its gadget will contain the number of the bit-
  1315. plane (1-6). If you click on the gadget again, it will cycle through the
  1316. characters 'S', 'C', and '-'. These represent a fully set or a fully clear
  1317. bitplane, and an undefined bitplane, respectively. The 'New' gadget will
  1318. erase the current bitplane definitions, allowing a new selection to be made.
  1319.  
  1320. WorkBench Icon
  1321. --------------
  1322.  
  1323.     This allows the workbench screen to be opened/closed.
  1324.  
  1325. Arrow Icons
  1326. -----------
  1327.  
  1328.     The upper pair of left and right arrow icons can be used to move
  1329. the upper disassembly window; the lower pair are for the lower disassembly
  1330. window (if this is open). By also pressing the right ALT key, either pair
  1331. can be used to move the memory window.
  1332.  
  1333. * ------------------------------------------------------------------------- *
  1334.  
  1335. 12) Keyboard Reference
  1336. ======================
  1337.  
  1338.     This section contains general program information, related to
  1339. the keys which invoke each feature of Disect. (For functions not linked to
  1340. a key, see Section 14). The complete list is below:
  1341.  
  1342. Windows    Cursor Keys        Move upper disassembly window
  1343. -------
  1344.     & LEFT ALT        Move lower disassembly window
  1345.     & RIGHT ALT        Move memory window
  1346.     & SHIFT        Move window fast
  1347.  
  1348.     A    {LEFT ALT}    Define disassembly window address
  1349.  
  1350.     1-9    {LEFT ALT}    Go to disassembly window marker
  1351.     SHIFT 1-9    {LEFT ALT}    Define disassembly window marker
  1352.  
  1353.     0    {LEFT ALT}    Retrieve last address stack entry
  1354.  
  1355.     ESCAPE        Refresh all windows
  1356.     +        Swap both disassembly window addresses
  1357.  
  1358.     \        Address/Offset display mode
  1359.     TAB        Single/double disassembly window
  1360.     QUOTE (above TAB)    Change number base (hex/decimal)
  1361.  
  1362.     Y        Move disassembly window to previous addr
  1363.     U        Move disassembly window to next address
  1364.     O        Move disassembly window after data area
  1365.  
  1366. Functions    F        Search memory
  1367. ---------    G        Continue search
  1368.     W        Fill memory
  1369.     Q        Copy memory
  1370.     S        Display symbols
  1371.     D        Disassemble to file
  1372.     I        Display information
  1373.     H        Display processor history
  1374.     M        Display memory dump
  1375.     Z        Evaluate expression
  1376.     X        DataStrings (see section 7)
  1377.     P        Dummy symbol selection
  1378.  
  1379.     DEL        Display preferences
  1380.     HELP        Display resident SysSymbol preferences
  1381.  
  1382.     ESCAPE        Abort search/disassemble to file
  1383.  
  1384. Process    E        Execute instruction (whole of JSR/BSR)
  1385. -------    T        Trace instruction (stops inside JSR/BSR)
  1386.  
  1387.     C        Breakpoint after PC & resume
  1388.     V        Breakpoint at PC DEA & resume
  1389.     N        Next instruction (without execute)
  1390.  
  1391.     K        Kill Process
  1392.     B        Define breakpoint
  1393.     L        Kill breakpoints
  1394.  
  1395.         DISASSEMBLY WINDOW ADDRESS (A)
  1396.         ==============================
  1397.  
  1398.     This opens a window through which to input the required address.
  1399. If the left ALT key is pressed with the 'A' key, then the input will be used
  1400. to define the lower disassembly window address.
  1401.  
  1402.         DISASSEMBLY WINDOW MARKER (1-9)
  1403.         =================================
  1404.  
  1405.     With the shift key, keys 1 to 9 will define disassembly window
  1406. markers 1 to 9 at the current disassembly window address. To delete a marker,
  1407. both keys can be pressed a second time. Without the shift key, the disass-
  1408. embly window will be moved to the address of the selected marker. If the left
  1409. ALT key is also pressed, then the lower disassembly window will be used.
  1410.  
  1411.         RETRIEVE STACKED ADDRESS (0)
  1412.         ==============================
  1413.  
  1414.     Key 0 will retrieve the last stacked address and move the dis-
  1415. assembly window to it. Again, left ALT can also be pressed to move the lower
  1416. disassembly window.
  1417.  
  1418.         REFRESH MAIN WINDOWS (ESCAPE)
  1419.         =============================
  1420.  
  1421.     As well as refreshing all windows in the main program screen,
  1422. the escape key will, if a Process exists, move the (upper) disassembly window
  1423. to the current PC address (if this address is not visible in a disassembly
  1424. window).
  1425.  
  1426.         MOVE TO PREVIOUS ADDRESS (Y)
  1427.         ============================
  1428.  
  1429.     This will move the disassembly window to the previous logged
  1430. address from the first logged address in the disassembly window. Left alt
  1431. will select the lower disassembly window.
  1432.  
  1433.         MOVE TO NEXT ADDRESS (U)
  1434.         ========================
  1435.  
  1436.     This will move the disassembly window to the next logged address
  1437. from the first logged address in the disassembly window. Left alt will select
  1438. the lower disassembly window.
  1439.  
  1440.         MOVE AFTER DATA AREA (O)
  1441.         ========================
  1442.  
  1443.     This will move the disassembly window to the address after the
  1444. first logged data address in the disassembly window. This is useful in order
  1445. to pass large (uniform) data areas.
  1446.  
  1447.         SEARCH MEMORY (F,G)
  1448.         ===================
  1449.  
  1450.     Key 'F' will open the Search Memory request window, with which
  1451. you can define the ranges of memory to be searched, the type of search data,
  1452. and the data to be searched for.
  1453.     At the top of the window are two string gadgets to input the
  1454. start and end addresses (inclusive) of a range. You should input the start,
  1455. and then the end, after which, if the range is ok, the address range will be
  1456. stored. Note that you may not enter zero as an address. The current ranges
  1457. are displayed in a window below these gadgets. To the right of this window
  1458. are gadgets to scroll through the list of address ranges. This list will be
  1459. initialised to contain the start and end addresses of any loaded project
  1460. memory. If you LMB on any address range, it will be selected, and can then
  1461. be changed. If you select a range, then enter no input for the start and end
  1462. addresses, the range will be deleted from the list. The RMB can be pressed to
  1463. un-select a selected address range. Note that this info applies to all other
  1464. windows where address ranges have to be specified. 
  1465.     The gadgets at the bottom of the window are used to select the
  1466. type of search. This may be byte, word, long, ASCII, or source. The string
  1467. gadget allows input of the search data. For byte/word/long, this must be a
  1468. sequence of expressions, with a comma to separate each parameter. For ASCII/
  1469. source, the text string entered is the search data. Note that ASCII will
  1470. search memory for a text string, while source will actually disassemble the
  1471. specified address ranges, and compare the resulting source with the input
  1472. text. Obviously, searching for source is slower. The case gadget allows you
  1473. to specify whether to ignore case when searching for ASCII/source. If check-
  1474. ed, then Disect will use case-sensitive search; if unchecked, then case will
  1475. be ignored.
  1476.     If searching for byte/word/long, you may enter a single '?' char-
  1477. acter instead of an expression, in order to specify that a search-element is
  1478. unknown. For example, if you entered 32,"A",?,16 for a byte search, then the
  1479. following would be successfully matched: 32,65,46,16 and 32,65,12,16... etc
  1480. When searching for ASCII/source, the '?' character may be used in the same
  1481. way. In order to specify a search for a '?' character, you must enter '??'
  1482. instead. When searching for ASCII or source, any number of spaces input as
  1483. the search data will be matched to any number of spaces (or tabs) during the
  1484. search.
  1485.     Key 'G' will continue a search which has been halted due to the
  1486. search data being found. If searching for byte/word/long or ASCII data, then
  1487. Disect will move the memory window (screen lower right) to the address where
  1488. the search data has been found. If searching for source, then the (upper)
  1489. disassembly window will be moved instead.
  1490.     Note that no checks are performed on the memory areas: if you
  1491. (accidentally?) read from hardware registers, etc, you'll probably regret it...
  1492.     An alarm sound will begin whenever the search data is found, or
  1493. when the search ends (data not found).
  1494.     In order to specify the end of an address range, it is possible
  1495. to enter the following into the 'End' string gadget:
  1496.  
  1497.     =    specifies an address range of a single byte (ie: the
  1498.         end address is the same as the start address) - most
  1499.         useful for Fill Memory (!)
  1500.  
  1501.     +X    specifies an address range of (X+1) bytes (ie: the
  1502.         end address is the start address + X; 'X' can be
  1503.         any valid expression)
  1504.  
  1505.     ,X    specifies an address range of X bytes; 'X' can be
  1506.         any valid expression
  1507.  
  1508. This is possible in all request windows which allow input of an address
  1509. range. (Search Memory/Fill Memory/Copy Memory/INCBIN/Load Memory/Save Binary/
  1510. Disassemble To File)
  1511.  
  1512.         FILL MEMORY (W)
  1513.         ===============
  1514.  
  1515.     This opens the Fill Memory request window, which is similar to
  1516. Search Memory (above). The fill data type may be byte, word, long, or ASCII.
  1517. Note that no checks are performed on the memory areas: if you (accidentally?)
  1518. write to hardware registers, etc, you'll probably regret it...
  1519.  
  1520.         COPY MEMORY (Q)
  1521.         ===============
  1522.  
  1523.     A window will open, allowing you to specify the start and end
  1524. addresses of the source memory area, and the start address of the destination
  1525. memory area. These two areas may overlap without any corruption occurring.
  1526. Note that no checks are performed on the memory areas: if you (accidentally?)
  1527. write to hardware registers, etc, you'll probably regret it...
  1528.  
  1529.         DISPLAY SYMBOLS (S)
  1530.         ===================
  1531.  
  1532.     This will open a window via which a list of all current user
  1533. symbols is displayed. At the window top is displayed the total number of
  1534. program and constant symbols. The gadgets at the bottom of the window allow
  1535. selection of whether to list program, constant, variable, address constant,
  1536. or unused symbols, and the order in which to list the symbols (either alpha-
  1537. betically, or by increasing symbol value).
  1538.  
  1539.     Another two gadgets allow you to delete or rename a selected
  1540. symbol. A symbol may be selected by LMB on it. Once a symbol has been
  1541. deleted, it cannot be retrieved. To rename a symbol, you should select it,
  1542. press the 'Rename' gadget, enter the new name into the string gadget which
  1543. is automatically activated, then press Enter.
  1544.  
  1545.     There is also another gadget, 'VM'. This allows a constant symbol
  1546. to be changed to a variable symbol, and vice versa. See 'Process Variables
  1547. Memory' for more info.
  1548.  
  1549.     When listing program symbols, if you LMB on the currently
  1550. selected symbol (ie: 2nd LMB on same symbol), then the symbol window will
  1551. be closed, and the (upper) disassembly window will be moved to the address
  1552. of the program symbol.
  1553.  
  1554.     If you press a letter key (with or without a shift key), or the
  1555. ".", or "_" keys, then, if the symbols have been sorted alphabetically, the
  1556. window will move to the first symbol beginning with that character.
  1557.  
  1558.     It is also possible to multiple-select symbols. This is done by
  1559. pressing the SHIFT key before you LMB on a symbol. If you press the RMB, then
  1560. the current multiple-selection will be inverted. The 'Delete' and 'VM' gadgets
  1561. will function on all of the currently selected symbols.
  1562.  
  1563.         DISASSEMBLE TO FILE (D)
  1564.         =======================
  1565.  
  1566.     Use of this feature is described in the tutorial (above); here is
  1567. some specific information. 
  1568.  
  1569.     The disassembly process occurs in two passes. On the first pass,
  1570. Disect disassembles the required address ranges internally, creating a list
  1571. of all referenced addresses which have not had a program symbol created for
  1572. them, a list of all required system symbols, and a list of all required user
  1573. symbols. Any immediate long numbers which lie within the disassembly address
  1574. range(s) which have not been replaced by a symbol are also checked for.
  1575.  
  1576.     Also, during the first pass, Disect performs checks for any local
  1577. program symbol references across the bounds of a global, For example:
  1578.  
  1579.     some_sr    bsr    .do_it
  1580.         rts
  1581.     another_sr    bsr    elsewhere
  1582.     .do_it    jsr    miles_away
  1583.  
  1584. If any such references are found, Disect will move the upper disassembly
  1585. window to the reference of the local program symbol, and the lower window
  1586. to the address of it. Disassembly to file will be abandoned.
  1587.  
  1588.     Disect will also warn you of any references to address which lie
  1589. within project memory range, but which are outside the disassembly range. If
  1590. one is found, a request window is opened which contains three gadgets:
  1591.  
  1592. 'Ignore' will resume disassembly, and cause the referenced address to be
  1593. stored in a permanent list so that if the address is referenced again (either
  1594. during the current, or any subsequent, disassemble to file), then Disect will
  1595. know not to bother telling you about it. The item 'Clear External Address
  1596. List' in the functions menu will erase the current list of these addresses.
  1597.  
  1598. 'Ignore All' will resume disassembly, and Disect will not inform you of any
  1599. external referenced addresses.
  1600.  
  1601. 'Quit' will...
  1602.  
  1603.     On the second pass, the disassembly occurs again; this time the
  1604. program and support source files are created. Now, any address references for
  1605. which no program symbol exists will have automatic symbols written for them.
  1606. For example, the following code:
  1607.  
  1608. 0000675372        lea    683208,a0
  1609.  
  1610.     ~    ~    ~
  1611.     ~    ~    ~
  1612.  
  1613. 0000683208        DC.W    10
  1614.  
  1615. would be disassembled as:
  1616.  
  1617.         lea    A683208,a0
  1618.  
  1619.     ~    ~    ~
  1620.     ~    ~    ~
  1621.  
  1622.     A683208    DC.W    10
  1623.  
  1624. After the whole disassembly is complete, there may still be some referenced
  1625. addresses which were not disassembled directly. For example:
  1626.  
  1627. 0000675372        move.w    683208,d0
  1628.  
  1629.     ~    ~    ~
  1630.     ~    ~    ~
  1631.  
  1632. 0000683206    data_table    DC.L    10
  1633. 0000683210        DC.L    20
  1634.  
  1635. Here, the first line would have been disassembled containing 'A683208', but
  1636. there would be no program symbol of this name. Instead, any missing address
  1637. references will be output to the end of the program file, by offsetting them
  1638. from the previous global program symbol. As an example, the code above would
  1639. result in:
  1640.  
  1641. A683208    EQU    data_table+2
  1642.  
  1643.     If Disect finds a data area where all bytes are NULL, instead of
  1644. creating lots of 'DC.X 0' source, Disect will convert the source to a single
  1645. line of 'DCB.X n', where n=the required number of bytes/words/longs. This
  1646. will not occur if the first line of the data area (ie:the only logged address
  1647. of the data area) has had it's DC.X operand (a zero!) replaced with a symbol,
  1648. or if the line has a line comment.
  1649.  
  1650.     During disassembly to file, Disect will concatenate multiple
  1651. lines of DC.B, DC.W, or DC.L statements to form (much) fewer lines of source.
  1652. Also, when outputting system or user constant EQUs, Disect will group them
  1653. using their prefix, in numeric order. For example:
  1654.  
  1655. SYMB_FIRST    EQU    -32
  1656. SYMB_SECOND    EQU    0
  1657. SYMB_FOURTH    EQU    $10
  1658.  
  1659.     The disassemble to file request window also contains gadgets:
  1660.  
  1661. 'Project' will define the disassemble address range list to match the current
  1662. project address ranges.
  1663. 'Clear' will clear the address range list.
  1664. 'Load' and 'Save' allow a ('.dfr') ascii file to be loaded/saved to be used
  1665. as the address range list.
  1666.  
  1667.     And last, but not least, any defined disassemble to file address
  1668. ranges will be displayed in the disassembly window as background colour 3
  1669. (blue, if you've not changed your WB prefs).
  1670.  
  1671.         DISPLAY INFORMATION (I)
  1672.         =======================
  1673.  
  1674.     The displayed information contains the number of logged program
  1675. addresses, and the number of program and constant user symbols. Below this
  1676. is displayed the address range and size of each project memory area, with the
  1677. type of the memory (C=chip, F=fast, P=public).  The (upper) disassembly
  1678. window can be moved to the start address of any of the project memory areas
  1679. simply by LMB on the text of the memory area.
  1680.  
  1681.         DISPLAY PROCESSOR HISTORY (H)
  1682.         =============================
  1683.  
  1684.     After any instruction is traced or executed (or skipped via key
  1685. 'N' - see below), or whenever an active Process reaches a breakpoint, or
  1686. whenever an exception occurs, the current processor state is stored. This
  1687. information is accessed via the processor history display. The most recent
  1688. entry is displayed in the lower window, with previous entries above. The
  1689. display of register contents is in hex, although by LMB on the digits of a
  1690. number, its value is displayed in denary in the small box in the top left of
  1691. the request window. The thing to note is that for any entry, the register
  1692. values represent the values after executing the previous instruction, while
  1693. the PC, SEA/DEA and instruction disassembly represent the next instruction
  1694. to be executed.
  1695.  
  1696.         DISPLAY MEMORY DUMP (M)
  1697.         =======================
  1698.  
  1699.     This opens a large memory dump window, the start address of which
  1700. will be initialised to the current address of the first line of the small
  1701. memory window in the main program screen. The window may be moved around
  1702. memory using the cursor keys (and the shift key to move it faster). A string
  1703. gadget in the window top left allows a new start address to be input. The
  1704. base of the address digits will be the same as the currently selected base
  1705. for the main program screen (denary or hex). Note that the ASCII display will
  1706. show the character '·' for any memory locations for which the content is out-
  1707. side the ASCII range of 32 to 127.
  1708.     By LMB on a memory location's content, Disect will display the
  1709. denary values of the byte, word, and long starting at that address. The cycle
  1710. gadget in the window allows you to select whether to display the B/W/L as
  1711. signed or unsigned denary.
  1712.     RMB on a memory location's content will cause the Base Offset
  1713. Address to be defined at the address of the selected byte. The preferences
  1714. will also be updated to display offsets instead of addresses.
  1715.  
  1716.         EVALUATE EXPRESSION (Z)
  1717.         =======================
  1718.  
  1719.     This opens a window containing a string gadget for input of an
  1720. expression. The current string content will be evaluated whenever 'Enter' is
  1721. pressed. Expression results are displayed as unsigned denary, signed denary
  1722. (if the sign bit is set; ie, either bit 31, bit 15, or bit 7 depending upon
  1723. whether the value is in the long, word, or byte value range - try it out with
  1724. results of 4294967295, 65535, and 255 - you'll see what I mean!), unsigned
  1725. and signed hex, ASCII, FFP (ie: the result integer is displayed as a long
  1726. FFP value), binary, any program symbol of value matching the result, any
  1727. matched address constant, and a hunk number and offset if the result is
  1728. within project memory range.
  1729.  
  1730.         DUMMY SYMBOL SELECTION (P)
  1731.         ==========================
  1732.  
  1733.     This will request a single expression, the result of which will
  1734. be passed to the Symbol Selection Window. This allows you to select symbol(s)
  1735. in the usual way, for any number, although obviously no information will be
  1736. stored about your selection. When a symbol match occurs, the window will
  1737. display the 'New', 'Zero', and 'Quit' gadgets as usual, but the 'Confirm'
  1738. gadget will be replaced with a 'Comment' gadget. If this is selected, then
  1739. the Symbol Selection window will close, and a message will appear in the
  1740. main window. By LMB on the mnemonic of an instruction within the disassembly
  1741. window, the actual text of the selected symbols can be automatically stored
  1742. as a line comment for the instruction. The comment text will automatically
  1743. have the chars "*!*" added to the end, allowing such comments to be found
  1744. in disassembled a source file, using a text editor. As an example, if a
  1745. program routine allocated temporary space for definition of a NewWindow
  1746. structure:
  1747.  
  1748.     link    a5,#-48
  1749.  
  1750. Although you cannot replace '-48' with 'nw_SIZE', by making a dummy selection
  1751. for a value of '48', the Symbol Selection window will list 'nw_SIZE'. By
  1752. selecting this, then the 'Comment' gadget, the symbol text is stored as
  1753. a comment (with a marker allowing it to be found and edited, when a source
  1754. file has been disassembled).
  1755.  
  1756.         DISPLAY PREFERENCES (DEL)
  1757.         =========================
  1758.  
  1759.     This window allows selection of program preferences. The gadgets
  1760. at the bottom of the window allow the last saved preferences to be loaded,
  1761. the current settings to be saved, the current settings to be used, and the
  1762. previous settings to be restored (ignoring any changes since window opened).
  1763. The preferences are as follows:
  1764.  
  1765. AutoSymbol    This enables/disables automatic symbol replacement. This means
  1766.     that as addresses are disassembled via display of the disassembly
  1767.     window(s), any address which has not been replaced by a program
  1768.     symbol will automatically be replaced by any program symbol which
  1769.     has a matching value. In addition, if the 'hardware' directory
  1770.     SysSymbols are resident, then any references to chip registers
  1771.     or CIA addresses will also be automatically replaced. This also
  1772.     includes the bit number of a btst/bset/bclr/bchg when the DEA
  1773.     is any of CIAA_PRA, CIAB_PRA, or CIAB_PRB. Also, any instructions
  1774.     of the form 'jsr dd(a6)' will have their displacements replaced
  1775.     with _LVO symbols, if a6 contains the base address of any of the
  1776.     libraries: Exec, DOS, Graphics, Intuition, ASL, MathFFP, GadTools.
  1777.     This only occurs if a Process exists, and will take place when
  1778.     the instruction at the PC is a jsr.    This preference also controls
  1779.     Process Variables Memory references    symbol replacement (see
  1780.     elsewhere).
  1781.  
  1782. Auto 0(Ax)    This enables/disables automatic display of a '0' before '(Ax)'
  1783.     for the address-register-indirect addressing mode. This is useful
  1784.     because some assemblers will automatically optimise address-
  1785.     register-indirection-with-displacement references to ARI if the
  1786.     displacement is zero. This feature allows a '0' to be displayed
  1787.     so that it can then be replaced with a symbol (for example:
  1788.     exec/lists.i 'LH_HEAD' which has the value 0).
  1789.  
  1790. Case    This allows selection of upper or lower case for disassembly.
  1791.     Note that assembler directives will always be disassembled as
  1792.     upper case.
  1793.  
  1794. Base    This allows selection of denary or hex for disassembly.
  1795.  
  1796. A7/SP    This allows selection of 'a7' or 'sp' for disassembly.
  1797.  
  1798. Local    This allows selection of the character to prefix local program
  1799.     symbols. This may be either '.' or '_'.
  1800.  
  1801. PSymb ':'    This enables/disables automatic display of a ':' character after
  1802.     program symbols in the program symbol field of a line.
  1803.  
  1804. SAD    This enables/disables automatic display of program symbols
  1805.     instead of addresses in such places as register values, memory
  1806.     dump addresses, addresses in request windows, etc.
  1807.  
  1808. Offset    This allows addresses to be displayed as hunk/project memory
  1809.     start offsets instead. If selected, any address which lie within
  1810.     the project memory range will be displayed as, for example,
  1811.     "0:256", where 0 is the hunk number, and 256 is the offset.
  1812.     In the disassembly window, this will be enclosed in "[]" chars.
  1813.     In addition, you may define a base offset address (using an item
  1814.     from the preferences menu). If you do this, then ALL addresses,
  1815.     not just addresses in project memory range, will be displayed
  1816.     as offsets relative to the base address, eg: "-$32", or "[+146]".
  1817.     A small request window is used to define the base address. This
  1818.     contains a string gadget for input of the address, and a check
  1819.     gadget to enable/disable the current base address.
  1820.  
  1821. Comment DS    This enables/disables automatic line comments when Disect defines
  1822.     a data area using a system DataString.
  1823.  
  1824. Erase DSC    This enables/disables automatic removal of DataString-defined
  1825.     line comments after symbolic replacement of a number.
  1826.  
  1827. Blank Lines    This preference enables/disables automatic blank lines. If used,
  1828.     Disect will add blank lines after any of these instructions:
  1829.         DBcc, Bcc, JMP, JSR, RTD, RTE, RTR, RTS.
  1830.  
  1831. Process Mem    This informs Disect whether or not to install a memory monitor
  1832.     when a Process is created (not if a Process is grabbed). If one
  1833.     is installed, then when the Process terminates, a request window
  1834.     will open to list any unfreed memory allocations. Disect will
  1835.     display the start and end addresses of each memory block, as well
  1836.     as the size. Also displayed will be either: 'SELF' if the memory
  1837.     was allocated by a function within the Process; the name of the
  1838.     library containing the function which allocated the memory (if
  1839.     this can be determined); 'ROM' if the memory was allocated by a
  1840.     ROM function which could not be named as a library. If the alloc-
  1841.     ator cannot be determined, then the return address when AllocMem()
  1842.     was called will be displayed. Any unfreed memory which is shown
  1843.     as being self-allocated is automatically freed by Disect.
  1844.     The memory monitor is installed by calling Exec.SetFunction() for
  1845.     the functions AllocMem() and FreeMem(). Before doing this, Disect
  1846.     first checks the current destination addresses of their JMP inst-
  1847.     ructions (the jump table just below ExecBase). If either of these
  1848.     instructions do not jump to a ROM address, then Disect will not
  1849.     attempt to install the memory monitor. Note that it is necessary
  1850.     to install a memory monitor for certain features of the Auto
  1851.     Trace mode (see elsewhere).
  1852.  
  1853. MaxMBinSize    This allows you to specify the maximum size of each file of a
  1854.     MultiBin file. See the specific section about MultiBin files for
  1855.     more info.
  1856.  
  1857. MaxSourceSz    This allows you to specify the maximum size of a source file
  1858.     when disassembling to file.
  1859.  
  1860. Save .Info    Whether or not to create icons for all saved files.
  1861.  
  1862. DSCT Buffer    Whether or not to use a RAM buffer when load/saving DSCT files.
  1863.  
  1864. Auto-AC/PS    Whether or not to auto-define either an address constant or a
  1865.     program symbol when an known data structure is identified (see
  1866.     section 15).
  1867.  
  1868. LibList LVO    Whether or not Disect should check the LibList whenever a JSR
  1869.     to a known function is executed (see section 15).
  1870.  
  1871.         DISPLAY SYSSYMBOL PREFERENCES (HELP)
  1872.         ====================================
  1873.  
  1874.     As mentioned above, this window allows selection of resident
  1875. SysSymbol (system symbol) data. The four gadgets at the bottom of the window
  1876. work as for Preferences (above). Response to changing the preferences occurs
  1877. when the window is closed. Note that you cannot remove a directory's data
  1878. from memory if it is used (ie: if any of it's symbols are used by the project
  1879. in memory). The digits after each directory's name represent the size of the
  1880. data file. It's best not to load data without using it, since any resident
  1881. data is checked in such circumstances as expression evaluation, checking if
  1882. a symbol name is used already, etc.
  1883.  
  1884.         EXECUTE INSTRUCTION (E)
  1885.         =======================
  1886.  
  1887.     Only available if a Process exists, this will execute the single
  1888. instruction at the PC. Note that the whole of a JSR/BSR will be executed, ie:
  1889. the Process will be suspended at the address after the JSR/BSR instruction.
  1890. Any permanent breakpoint at the PC will be ignored.
  1891.     One small point to add is that it is possible to execute PC-
  1892. relative JSR/BSR instructions which use 68020 specific address modes, even
  1893. with a pre-68020 processor. (The reason: JSR/BSR instructions are buffered
  1894. before execution, so therefore PC-relative modes get changed to absolute-
  1895. long address mode. In the case of BSR, the instruction is changed to JSR
  1896. absolute-long, so therefore any BSR which uses an 020 mode is permitted
  1897. on a pre-68020 processor. If you didn't follow that, it does not matter...)
  1898.  
  1899.         TRACE INSTRUCTION (T)
  1900.         =====================
  1901.  
  1902.     This will trace the instruction at the PC, if a Process exists.
  1903. This means that if the instruction is a JSR/BSR, then the Process will be
  1904. suspended at the first instruction of the subroutine which is called. Any
  1905. permanent breakpoint at the PC will be ignored. In addition, if you trace
  1906. a JSR or a BSR, then any form of breakpoint at the PC is ignored.
  1907.  
  1908.         RESUME PROCESS (Process Menu)
  1909.         =============================
  1910.  
  1911.     This will activate a suspended Process, hence it and Disect will
  1912. be running 'simultaneously' (multi-tasking). Any permanent breakpoint at the
  1913. PC will be ignored during the (first) execution of the instruction there.
  1914.  
  1915.         BREAKPOINT AFTER PC (C)
  1916.         =======================
  1917.  
  1918.     This will define a stop breakpoint after the instruction at the
  1919. PC, and resume the Process. This is useful if the instruction is a DBcc/Bcc,
  1920. since an entire program loop may be executed, and the Process suspended after
  1921. the loop has been completed the required number of times. A permanent break-
  1922. point at the PC will be ignored during the (first) execution of the instruc-
  1923. tion there.
  1924.  
  1925.         BREAKPOINT AT DEA (V)
  1926.         =====================
  1927.  
  1928.     This will define a stop breakpoint at the DEA of the instruction
  1929. at the PC, and resume the Process. This, again, is useful for executing
  1930. program loops, but ones where the exit point of a loop does not sequentially
  1931. lead to the next instruction. Any permament breakpoint at the PC will be
  1932. ignored during the (first) execution of the instruction there.
  1933.  
  1934.         NEXT INSTRUCTION (N)
  1935.         ====================
  1936.  
  1937.     This will move the PC to the next instruction without executing
  1938. the current one. Any breakpoint at the PC will be ignored.
  1939.  
  1940.         KILL PROCESS (K)
  1941.         ================
  1942.  
  1943.     This will kill a suspended Process. This is achieved by changing
  1944. the Process's stack pointer to the address it was when the Process began,
  1945. moving the PC to an RTS instruction, and resuming the Process.
  1946.     Whenever a Process terminates, if any data exists, you will be
  1947. given a chance to save it before it is (automatically) erased.
  1948.  
  1949.         DEFINE BREAKPOINT (B)
  1950.         =====================
  1951.  
  1952.     This allows a breakpoint to be defined. The program requests the
  1953. address of the breakpoint, and it's type. This may be permanent, conditional,
  1954. stop, or count. Conditional breakpoints also require an expression. This will
  1955. be evaluated after input, and if no error occurs, the breakpoint will be
  1956. defined. Whenever execution of an active Process reaches a conditional break-
  1957. point, then its expression will be evaluated. If the result is TRUE, ie: not
  1958. zero, then the Process suspended. If the result is FALSE (equal to zero),
  1959. then the Process is resumed. If the expression cannot be evaluated (for
  1960. example, due to an unknown symbol name), then the Process will be suspended,
  1961. and an error message displayed.
  1962.     Count breakpoints have associated with them a long counter. When-
  1963. ever the breakpoint is reached, the counter is decreased. If it reaches zero,
  1964. then the breakpoint is removed, and the Process suspended, otherwise the
  1965. Process will resume.
  1966.     Stop breakpoints are simple breakpoints which will cause the
  1967. Process to be suspended. They are removed whenever encountered. Stop break-
  1968. points are in fact count breakpoints with an initial counter value of 1.
  1969.     Note that an alternative method of defining a breakpoint is to
  1970. LMB on the address digits in the disassembly window, at the address where the
  1971. breakpoint is required.
  1972.  
  1973.     When an active Process reaches a breakpoint, if the breakpoint
  1974. causes the Process to be suspended, then the PC will be at the address of
  1975. the breakpoint, and the instruction there will not yet have been executed.
  1976. Whenever an exception occurs, the PC will either be at the address of the
  1977. instruction which caused it, or at the address of the next instruction.
  1978.  
  1979.         KILL BREAKPOINTS (L)
  1980.         ====================
  1981.  
  1982.     This will remove all currently-defined breakpoints. It works even
  1983. when the Process is active.
  1984.  
  1985. * ------------------------------------------------------------------------- *
  1986.  
  1987. 13) Mouse Reference
  1988. ===================
  1989.  
  1990.     This section describes the areas of the main program screen which
  1991. will respond to LMB or RMB activity.
  1992.  
  1993. Disassembly Window
  1994. ------------------
  1995.  
  1996.     1) Address Digits LMB at left of window to define breakpoint. #
  1997.     2) Address Digits RMB at left of window to remove breakpoint.
  1998.     3) Program Symbol area LMB define program symbol for the address.
  1999.     4) Program Symbol area RMB on a local moves window to its global.
  2000.     5) Mnemonic LMB to access address functions.
  2001.     6) Mnemonic RMB to move PC to instruction.
  2002.     7) Number LMB in instruction operands to replace with symbol(s).
  2003.     8) Program Address RMB in instruction operands to stack current
  2004.         address and move window to new address. *
  2005.     9) Displacement RMB in instruction operands to stack current
  2006.         address and move window to EA, eg: 32(a6). *
  2007.  
  2008. # Right ALT may also be pressed, which will move the memory window to the
  2009.   address instead of defining a breakpoint.
  2010.  
  2011. * Left ALT may also be pressed to move the lower disassembly window; right
  2012.   ALT may be pressed to move the memory window (in which case, no address
  2013.   will be stored on the address stack).
  2014.  
  2015. PC/SR/EA Window
  2016. ---------------
  2017.  
  2018.     1) PC Value Digits LMB to define new PC value.
  2019.     2) SR Value Digits/Flags Text LMB to define new SR value.
  2020.     3) SEA/DEA Text LMB to select register zoom lock.
  2021.     4) SEA/DEA Value Digits RMB to display previous program symbol.
  2022.  
  2023.  
  2024. Register Window
  2025. ---------------
  2026.  
  2027.     1) D0-D7/A0-A7 Value Digits LMB to define new register value.
  2028.     2) D0-D7/A0-A7 Value Digits RMB to show previous program symbol
  2029.     4) D0-D7/A0-A7 Text LMB to select register-zoom lock.
  2030.     5) D0-D7/A0-A7 Text LMB and CTRL key to define an address
  2031.         constant symbol (see section 5).
  2032.  
  2033. Memory Window
  2034. -------------
  2035.  
  2036.     1) Address Digits LMB to define new memory display address.
  2037.  
  2038. The following request windows also have responses to mouse buttons:
  2039.  
  2040. Memory Dump
  2041. -----------
  2042.  
  2043.     1) Memory content LMB to display byte/word/long value as denary.
  2044.     2) Memory content RMB to define base offset address.
  2045.  
  2046. Breakpoints Window
  2047. ------------------
  2048.  
  2049.     1) Breakpoint information LMB to move (upper) disassembly window.
  2050.  
  2051. Symbol Window
  2052. -------------
  2053.  
  2054.     1) Symbol name LMB (twice) to move (upper) disassembly window.
  2055.  
  2056. Information Window
  2057. ------------------
  2058.  
  2059.     1) Project memory range LMB to move (upper) disassembly window.
  2060.  
  2061. * ------------------------------------------------------------------------- *
  2062.  
  2063. 14) Menu Reference
  2064. ==================
  2065.  
  2066.     This section details any program functions which are accessible
  2067. only via menus (no keyboard commands), and are not documented elsewhere.
  2068.  
  2069.         SAVE BOOT BLOCK (Project/Save Menu)
  2070.         ===================================
  2071.  
  2072.     This allows an area of memory to be saved as a boot-block. (Very
  2073. handy for making your favourite game a little more enjoyable!). Note that
  2074. the boot-block checksum will be defined by Disect.
  2075.  
  2076.         INSERT BINARY FILE (Project Menu)
  2077.         =================================
  2078.  
  2079.     This allows a binary file to be loaded into current project
  2080. memory.
  2081.  
  2082.         SCAN '.GS' FILE (Project/Load Menu)
  2083.         ===================================
  2084.  
  2085.     This allows a '.gs' file as produced by GenAm to be scanned, and
  2086. its constant symbols extracted. When doing this, if Disect finds a symbol
  2087. name which is already used (either by a system or a user symbol), then the
  2088. values of the two symbols are compared. If they both have the same value,
  2089. then the symbol from the '.gs' file is ignored. If the values differ, then
  2090. a request window will open, allowing you to either rename the symbol from
  2091. the '.gs' file (type in the new name, and press 'Enter'), or to ignore the
  2092. symbol from the '.gs' file (click on the 'Ignore' gadget). Note: it is best
  2093. to scan a '.gs' file ONLY AFTER you have already loaded any required system
  2094. symbols for your current project, since otherwise any symbol name collisions
  2095. with system symbols will not be detected. When you later save your '.DSCT'
  2096. data, the symbols read from the '.gs' file will also be saved, so you only
  2097. need to scan a '.gs' file once.
  2098.     When using this function, it is now (as of v1.9) possible to use
  2099. standard DOS pattern matching to include/exclude certain symbols.
  2100.  
  2101.         EQU SYMBOL DEFINITION (Functions/Symbols Menu)
  2102.         ==============================================
  2103.  
  2104.     This allows manual definition of a constant symbol.
  2105.  
  2106.         SET SYMBOL DEFINITION (Functions/Symbols Menu)
  2107.         ==============================================
  2108.  
  2109.     This allows manual definition of a constant symbol which can be
  2110. redefined later to have a different value. Quite useful when using macros
  2111. for certain things...
  2112.  
  2113.         DEFINE ADDRESS CONSTANT (Functions/Symbols Menu)
  2114.         ================================================
  2115.  
  2116.     This enables you to define an address constant symbol by entering
  2117. an address to use as its value. You can also define an AC by pressing the
  2118. CTRL key and LMBing on the text of 'd0', etc, in the register window. (See
  2119. section 5 for more about address constants).
  2120.  
  2121.         DISPLAY PREVIOUS PS/AC (Functions/Symbols Menu)
  2122.         ===============================================
  2123.  
  2124.     This allows you to input an address, for which will be displayed
  2125. either the previous program symbol or address constant, plus any offset.
  2126. Note that by RMB on the digits of an address or data register, or on the
  2127. digits of the current SEA or DEA, the relvant address will be used for this
  2128. function.
  2129.  
  2130.         ERASE EXTERNAL ACs (Functions/Symbols Menu)
  2131.         ===========================================
  2132.  
  2133.     This will erase all address constant symbols of any value which
  2134. is not an address within project memory.
  2135.  
  2136.         SEARCH FOR SYMBOL USE (Functions/Symbols Menu)
  2137.         ==============================================
  2138.  
  2139.     This allows a very fast search for the use of any system or user
  2140. symbol. After you have entered the required symbol name, if this is known by
  2141. Disect, then a search of all logged addresses is performed to see if this
  2142. symbol has been used to replace any number within the project.
  2143.  
  2144.         LIBRARY FUNCTION INFO (Functions Menu)
  2145.         ======================================
  2146.  
  2147.     This allows you to input a function name (with or without the
  2148. '_LVO'), for which Disect will check the LibList, in order to display the
  2149. function's information. It is necessary to have the relevant system symbols
  2150. directory resident if the function is a system _LVO. (See also section 15).
  2151.  
  2152.         KNOWN DATA STRUCTURES (Functions Menu)
  2153.         ======================================
  2154.  
  2155.     This menu item holds two sub-items. The first allows any current
  2156. structure pointer in the data structures window to be erased by LMB on it.
  2157. The second will erase all known data structures which are not within project
  2158. memory. (See also section 15).
  2159.  
  2160.         PLAY AUDIO SAMPLE (Functions Menu)
  2161.         ==================================
  2162.  
  2163.     This opens a request window which allows specification of the
  2164. start and end addresses of an area of memory to be played as an audio sample.
  2165. Once a sample has been identified, it can be saved as a raw/binary file.
  2166.  
  2167.         OPEN TRACKDISK DEVICE (Functions Menu)
  2168.         ======================================
  2169.  
  2170.     This allows the trackdisk device to be opened (DF0:), and used
  2171. for disk IO if required by a Process. Typically, this is required when you
  2172. have loaded a boot-block, then later saved your project as a multibin file.
  2173. When this is later re-loaded, you can open the trackdisk device in order to
  2174. execute the code of the original boot block. If opened, then a reserved
  2175. symbol name becomes valid ('IOEXTTDP'), which gives the address of the
  2176. required IOExtTD structure. There is also another menu item which will
  2177. turn off the drive motor (very useful in certain circumstances).
  2178.  
  2179.         EXECUTABLE BINARY OFFSET (Functions Menu)
  2180.         =========================================
  2181.  
  2182.     This strangely-titled function has a very specific use. Suppose
  2183. you have loaded an executable file into memory, and have decided you want
  2184. to patch, for example, a NOP into address [2:$2438] (ie: the 3rd hunk, offset
  2185. $2438). What is required is to erase the project, then re-load the executable
  2186. as a binary file, so that it exists in memory as a single block of code,
  2187. which can be changed and re-saved. But! Obviously, address [2:$2438] could
  2188. be very difficult to find within this single block.
  2189.     This function solves this problem. It has two ways of being used,
  2190. depending on the type of the current loaded project. If an executable has
  2191. been loaded, you will be requested to enter a hunk number and offset, which
  2192. Disect will use to scan the original executable file on disk, in order to
  2193. display the offset into the file of the required byte.
  2194.     If a binary file has been loaded (ie: an executable file loaded
  2195. as a binary file), you will again be requested to enter a [hunk:offset],
  2196. (which of course refers to a position within the executable file when it
  2197. has been loaded as an executable, and its hunks expanded), and Disect will
  2198. move the disassembly window to the required byte within memory.
  2199.  
  2200.         DISPLAY BREAKPOINTS (Process/Breakpoints Menu)
  2201.         ==============================================
  2202.  
  2203.     This displays any defined breakpoints: the breakpoint address, 
  2204. and breakpoint type. Permanent breakpoints are denoted by '*' and conditional
  2205. by '?'. Count and stop breakpoints have a number displayed with represents
  2206. the remaining counter value (a stop breakpoint is a count breakpoint of value
  2207. 1). Conditional breakpoints have their expressions displayed after the '?'.
  2208. By LMB on a breakpoint text line, the (upper) disassembly window can be moved
  2209. to the address of the breakpoint.
  2210.  
  2211.     BREAKPOINT AT ACTIVE PROCESS PC (Process/Breakpoints Menu)
  2212.     ==========================================================
  2213.  
  2214.     This allows Disect to regain control of an active Process. In
  2215. terms of Exec task-switching, the Process will be either Wait()ing on signals
  2216. or Ready (suspended only until its next quantum). If the Process is Waiting,
  2217. then the breakpoint will be defined, but the Process will remain Waiting
  2218. until it receives a valid signal (which can be caused by, eg: LMB on it's
  2219. window), at which point it will reach the breakpoint.
  2220.     If the Process is Ready, then the breakpoint can only be defined
  2221. if the Process's PC is within project memory range (ie: not within ROM, or a
  2222. system library, etc).
  2223.     Note! This function is very handy if your Process goes into an
  2224. infinite loop!!
  2225.  
  2226.         THE 'PATCH' MENU
  2227.         ================
  2228.  
  2229.     This allows you to patch certain (useful) instructions into your
  2230. project. Whenever you do this, a request window will open, requesting an
  2231. address for the instruction, and possibly a branch/jump destination address.
  2232. Note that whenever this window opens, the required addresses are initialised
  2233. using the current disassembly window(s) start address(es).
  2234.  
  2235.     Also in this menu is the item 'Address Remap'. This is used when
  2236. maybe you've gone through a boot block, and have loaded some code which would
  2237. normally reside at say, address $400. In order to run such code, it is often
  2238. necessary to remap all address references within the 'normal' address range
  2239. to be references within the actual loaded address range. (Personally, I often
  2240. remap things which normally run in the first 1 meg, to things which run at
  2241. the same relative addresses in the second 1 meg. Obviously using MultiBin
  2242. files...). Anyway, this menu item opens a window into which you input the
  2243. Start and End addresses of the normal address range, and the Base address
  2244. of the actual loaded address range. For example, maybe remap address range of
  2245. Start $400 and End $7ffff, to a Base address of $100400 (up to and including
  2246. address $17ffff). Once you have defined these, and enabled it, Disect will
  2247. then automatically remap any LONG address references (this is done as they
  2248. are displayed in the disassembly window). Disect also shows a temporary 'R'
  2249. marker when this happens.
  2250.  
  2251.     Also in this menu are two items which allow you to easily remap
  2252. a long address displayed as a 'DC.L' assembler directive, and also something
  2253. such as 'move.l #$400,d0'. After selecting the menu item, you should then LMB
  2254. either on 'DC.L' text, or the '#$400' text, or anywhere else to cancel.
  2255.  
  2256.     But! What to do with something such as: 'move.w d0,$400.w', when
  2257. you want it to be 'move.w d0,$100400'. The menu item 'Remap XX.W' handles
  2258. this. After selecting it, you should LMB on the mnemonic of any instruction
  2259. containing the addressing mode Absolute Word as either the SEA or DEA (or
  2260. both). This will remap the word address to the required long address. Such
  2261. addresses are displayed enclosed in '<<' and '>>.w' parentheses. Any remapped
  2262. word addresses can be safely executed or traced using a Process. The thing to
  2263. note is that whenever a long address is remapped (as above), then the actual
  2264. address in memory is updated. However, whenever a word address is remapped,
  2265. Disect basically puts a special kind of breakpoint over the relevant
  2266. instruction, and creates some .DSCT data (so remember to save this). So if,
  2267. for example, you were dissecting something which you had converted to a
  2268. MultiBin file, and you then saved the MultiBin file, any remapped long
  2269. addresses will be saved in this file, whilst the breakpoints of any remapped
  2270. word addresses are temporarily removed while the file is saved (so the
  2271. original word addresses are saved intact), and the information about any
  2272. remapped word addresses is saved in your .DSCT data file.
  2273.  
  2274. * ------------------------------------------------------------------------- *
  2275.  
  2276. 15) LibList And Known Data Structures
  2277. =====================================
  2278.  
  2279.     The LibList can be found on the second Disect disk. This consists
  2280. of a list of functions of the following system libraries: Exec, Dos, Graphics
  2281. Intuition, Workbench, Icon, GadTools, and ASL (or maybe less if you've only
  2282. got the demo version). Its main use is as follows. If you have replaced the
  2283. offset for a JSR xx(A6) with an _LVO symbol, if you then press the CTRL key
  2284. and RMB on the _LVO symbol, Disect will display the function's use, inputs,
  2285. outputs, etc. The same can be achieved using the 'Library Function Info'
  2286. menu item in the Functions menu, although for system functions, the relevant
  2287. directory's symbols must be resident. You can even define your own LibList
  2288. entries for third-party libraries (see the 'User' directory on the LibList
  2289. disk, and remember to follow the same format as the existing LibList function
  2290. files for system libraries).
  2291.  
  2292.     Within a LibList function file, the names of system structures
  2293. are prefixed with a '$' character. This means that whenever you press the
  2294. 'E' key to execute an instruction (or during Auto Trace Mode), if the PC
  2295. instruction is a JSR to a system function, Disect will look in the LibList
  2296. function file for the relevant function, and identify the addresses of known
  2297. system data structures. This can be disabled using the 'Do LibList for PC
  2298. _LVOs' preference.
  2299.  
  2300.     The known data structures of your Process are displayed in the
  2301. Structure Pointers window (where the memory window is; the two can be swapped
  2302. using the BackSpace key, or the left-most icon in the main window). This
  2303. displays, for example:
  2304.  
  2305.     a0 -> nw_    NewWindow
  2306.  
  2307. So, therefore, a0 points to a NewWindow structure. As well as being useful,
  2308. this has another purpose. If you have created a Process for your loaded
  2309. project, then when, say, a0 does point to a NewWindow structure, if the
  2310. Intuition System Symbols are resident, then Disect can auto-replace any
  2311. references to the known data, such as:
  2312.  
  2313.     move.w d0,0(a0)   becomes:    move.w d0,nw_LeftEdge(a0)
  2314.  
  2315. Note that this only happens if you have a Process, since Disect only ever
  2316. replaces for the instruction at the PC.
  2317.  
  2318. In addition, the preference 'Structure Auto-AC/PS' is used to prevent or
  2319. allow Disect to automatically define either an address constant, or a program
  2320. symbol at the start address of the data. If this address is within project
  2321. memory range, then Disect will define a program symbol. This will be a lower
  2322. case version of the structure name, with a unique number, for example:
  2323. 'newwindow0'. If the address of the data is not within project memory, then
  2324. Disect defines an address constant symbol, which will be an upper case
  2325. version of the structure name. For example, on exit from DOS.Open(), d0 (if
  2326. not NULL), will be a BCPL pointer to a FileHandle structure. In this case,
  2327. Disect will define two address constant symbols, for example:
  2328.  
  2329.     _FILEHANDLE0    which represents the BPTR value
  2330.  
  2331.     FILEHANDLE0        which represents the actual address
  2332.  
  2333.     The Structure Pointers window also allows you to input either
  2334. the name of a system structure, or the prefix of a structure's symbols (eg:
  2335. 'nw' for 'NewWindow'), by LMB on either the prefix, or name text areas within
  2336. the Structures window. When you do this, Disect attempts to identify a system
  2337. structure using the current resident System Symbols (so make sure you've got
  2338. them so). If the structure is not found, then Disect assumes it to be a user
  2339. data structure. If, for example, you type in an unknown prefix text, eg:'ud_'
  2340. then this will be stored as a known user structure, which will be initially
  2341. 'UnNamed'. This can be renamed as required by typing the new name into the
  2342. name text area.
  2343.  
  2344.     As well as replacing (ax) offsets for references into known
  2345. system data structures, Disect will do the same for user data structures.
  2346. If, for example:
  2347.         a5 -> vm_    Variables
  2348.  
  2349. Obviously, a5 is the program's variables base pointer. So, if you had defined
  2350. constant symbols, such as 'vm_ScreenP', or maybe 'vm_ExecBase', any reference
  2351. into the program's variables will be automatically replaced as you single-
  2352. step your Process.
  2353.  
  2354.     Related to 'Known Data Structures' is a menu item of the same
  2355. name in the Functions menu. This allows you to erase a single structure (by
  2356. LMB on it in the Structures window), or to erase all known structures which
  2357. exist outside project memory.
  2358.  
  2359. * ------------------------------------------------------------------------- *
  2360.  
  2361. 16) Process Variables Memory
  2362. ============================
  2363.  
  2364.     As of V1.8, if a Process exists, it is possible to define an area
  2365. of memory as variables memory which is used by the Process. This memory may
  2366. be either within the Process's memory (project memory range), or it may have
  2367. been allocated by the Process. This is most useful when dissecting a program
  2368. which references its variables using either of the addressing modes ARID
  2369. (eg: '32(a4)'), or ARIDI (eg: '16(a5,d0.w)'), since it allows references
  2370. to known variables to be automatically replaced with user-defined symbols,
  2371. as will normally occur with direct address references to logged addresses.
  2372.  
  2373.     The 'Process' menu contains an item 'Variables Memory'. This
  2374. will open a request window which contains: two string gadgets for input of
  2375. variables memory start and size; a single string gadget for input of the
  2376. address of a 'JSR _LVOAllocMem(a6)' instruction; and two more gadgets, 'Ax',
  2377. and 'Previous'.
  2378.  
  2379.     The first two string gadgets allow the variables memory area to
  2380. be specified directly, if this is known. If you enter a start address and a
  2381. size which matches the address and size of any block of memory which is known
  2382. to have been allocated by the Process, then the address of the 'JSR AllocMem'
  2383. which allocated this memory will automatically be stored in the third string
  2384. gadget. It is also possible to enter the address of a 'JSR AllocMem', from
  2385. which Disect will be able to determine the address and size of the variables
  2386. memory. The 'Previous' gadget will automatically define all three string
  2387. gadgets according to the last memory allocation made by the Process. Note
  2388. that this is only possible if a memory monitor was installed when the Process
  2389. was created (see main preferences).    The 'Ax' gadget allows you to select
  2390. which address register is to be taken as a variables memory base pointer.
  2391.  
  2392.     The purpose of this is best illustrated by example. If you were
  2393. dissecting a Process which had allocated a block of memory and stored its
  2394. address in a4, or had done 'lea [1:0],a4', and you had the following:
  2395.  
  2396.     move.b    #24,32(a4)
  2397.  
  2398. If you LMB on the '32' and replace it with a user constant symbol which you
  2399. named 'some_var':
  2400.  
  2401.     move.b    #24,some_var(a4)
  2402.  
  2403.     If the DEA is within a known variables memory area, then the
  2404. symbol 'some_var' is treated as a 'variable constant symbol'. What this means
  2405. is that whenever the PC reaches any instruction which contains either an ARID
  2406. or a ARIDI reference such as '32(a4)', then Disect will automatically replace
  2407. the '32' with the known variable symbol 'some_var'.
  2408.  
  2409.     Since it is not necessarily true that all such references are
  2410. in fact references to variables memory, Disect will only automatically
  2411. replace these when the PC is at the relevant instruction (at which time it
  2412. is possible for Disect to know for certain). So, any references which are
  2413. found which might be variables are marked with a 'V' character next to where
  2414. breakpoint markers appear. If you wish to confirm that an instruction does
  2415. in fact reference variables memory, then you simply LMB on the 'V' marker.
  2416. Incidentally, whenever a DC.L is disassembled, if there is a program symbol
  2417. which exists which matches the value of the DC.L operand, then a 'P' marker
  2418. will be displayed, which can be LMB clicked in the same way to auto-replace.
  2419.  
  2420.     All of the information contained in the Variables Memory request
  2421. window is saved as part of the DSCT data file, so that, for example, once
  2422. the 'JSR AllocMem' which allocates the variables memory has been identified,
  2423. Disect will automatically define the variables memory start and size when
  2424. this instruction is executed the next time you load the original Process (as
  2425. long as a memory monitor was installed when the Process was created).
  2426.  
  2427. * ------------------------------------------------------------------------- *
  2428.  
  2429. 17) Grabbing An Existing Process
  2430. ================================
  2431.  
  2432.     The 'Project' menu item 'Grab Process' allows an existing memory-
  2433. resident process to be grabbed, and used as if the Process had been created
  2434. by Disect in the normal way. A request window will open, which will list
  2435. all current Processes which are waiting, either as a result of a call to
  2436. Exec Wait(), or Exec WaitPort(). To grab a process, simply LMB on its name
  2437. to select it, then click on the 'Grab' gadget. At this point, if the Process
  2438. is no longer Waiting, then Disect will not attempt to grab it. If the Process
  2439. is still Waiting, Disect will effectively send it one of the signal(s) it is
  2440. waiting for, and the Process will resume, under control of Disect. Lovely!
  2441.     In addition, the request window also displays the type of each
  2442. Process (workbench or CLI executed) and the address of its Process structure.
  2443. Note the following: a process may be waiting, but it may not have called
  2444. Exec Wait() or WaitPort() directly. If a process has actually called DOS
  2445. WaitPkt() (which indirectly calls Exec Wait())), then after being grabbed,
  2446. the PC will be within DOS WaitPkt(). Disect will warn you if this happens -
  2447. you will then have to trace the Process until DOS WaitPkt() returns, which
  2448. (hopefully) will be within project memory. (I think this occurs mostly with
  2449. CLI processes, which could not be grabbed by Disect until V1.9).
  2450.  
  2451.     Also in the 'Project' menu is another item 'Ungrab Process'. This
  2452. will allow a grabbed Process to be resumed, no longer under the control of
  2453. Disect.
  2454.  
  2455.     This feature should be used with caution. It is vital that some
  2456. Processes remain functional at all times, ie: it is not safe to grab them
  2457. since their activities must not be interrupted. The only way to discover if
  2458. a Process can be safely grabbed (and ungrabbed) is to try it. Note that some
  2459. Processes can be grabbed, and only when you attempt to ungrab them will
  2460. problems occur. You have been warned...
  2461.  
  2462.     Another word of warning: a Process which has been grabbed may
  2463. have its SegList memory (the memory in which the Process resides) freed
  2464. automatically, as soon as the Process has replied to its WorkBench start-up
  2465. message. As a result, it may be unsafe to single-step the last instructions
  2466. of a Process, since the OS may free the Process's memory before the very last
  2467. instruction has been executed by Disect. As an example:
  2468.  
  2469.     bsr    close_down    ; reply to WB message
  2470.  
  2471.     moveq.l    #0,d0    ; set return code
  2472.  
  2473.     rts        ; Process terminates here !
  2474.  
  2475. If you execute (key 'E') the bsr, the Process replies to its WB start-up
  2476. message, which may cause the Process's memory to be freed. Disect will
  2477. then have a PC at the moveq.l instruction, but any operation which uses
  2478. memory (eg: opening a Disect window) may cause the content of the PC
  2479. address to become corrupt. If this occurs, then you should select the
  2480. 'Move PC To Return Code' item from the 'Process' menu. This will move
  2481. the PC to an address which is guaranteed to contain the final two
  2482. instructions in the example above.
  2483.  
  2484. * ------------------------------------------------------------------------- *
  2485.  
  2486. 18) Auto Trace Mode
  2487. ===================
  2488.  
  2489.     Hopefully, this will at times prove to be a rather useful little
  2490. feature. What it does is to automatically trace the instructions of your
  2491. Process until some certain pre-specified condition is met. In conjunction
  2492. with Disect's automatic symbol replacement (ARID hardware register, Process
  2493. variables memory references, _LVOs), it can be quite revealing! Auto-trace
  2494. mode is accessed via the 'Process' menu, which will open a request window.
  2495. This contains a 'Resume' and a 'Quit' gadget: the first will enable auto
  2496. trace mode, whilst the second will not. Note that once enabled, auto trace
  2497. mode can be disabled by pressing the 'Esc' key. Whenever you save the main
  2498. program preferences, the current auto trace mode settings and expressions are
  2499. also saved. The remaining content of the auto trace request window is roughly
  2500. divided into two.
  2501.  
  2502.     On the left, you have six check gadgets and two string gadgets.
  2503. These define the conditions which will cause auto trace mode to be disabled.
  2504. The first two check gadgets are used to define whether or not auto trace mode
  2505. is disabled whenever an instruction is reached which will attempt to perform
  2506. a word or long read/write using an odd source/destination effective address.
  2507. As with all the conditions which may disable auto trace mode, the Process
  2508. will 'suspend' before the current instruction has been executed.
  2509.  
  2510.     The third check gadget is used to disable auto trace mode when-
  2511. ever the instruction at the PC is RTS. This can be used to effectively
  2512. resume the Process until the RTS of the current function/subroutine. Note
  2513. that Disect will count how many JSR/BSR instructions are traced, in order
  2514. to know how many RTS instructions must be ignored before the actual RTS
  2515. which will disable auto trace mode is reached.
  2516.  
  2517.     The next check gadget, if checked, will cause auto trace mode
  2518. to be disabled whenever the destination effective address of an instruction
  2519. is not within 'permitted' memory. Disect considers the following to be
  2520. permitted:        
  2521.  
  2522.     1) The memory in which the Process resides.
  2523.     2) The memory in which the Process's Process STRUCTURE resides.
  2524.     3) The Process's stack.
  2525.     4) Memory used by the LIB structure of any resident library.
  2526.     5) Any memory allocated by the Process.
  2527.  
  2528. Any writes to memory allocated by the Process will only be detected as being
  2529. permitted if a memory monitor was installed when the Process was created (not
  2530. grabbed!). This option can be found in the Preferences request window. For
  2531. word or long writes to memory, Disect will also check if the address of the
  2532. last byte written is outside permitted memory.
  2533.  
  2534.     The final two check gadgets are used to enable/disable each
  2535. expression entered into the two string gadgets. If enabled, before tracing
  2536. an instruction, Disect will evaluate an expression, and will disable auto
  2537. trace mode if the result is TRUE (non-zero). Note that this is the equivalent
  2538. of placing a conditional breakpoint at every instruction of your Process
  2539. (which would be otherwise impossible), including any external libraries or
  2540. functions, including ROM (also not otherwise possible). If the expression
  2541. contains either of the reserved symbol names 'SEA' and/or 'DEA', then if
  2542. an instruction does not have a source/destination effective address, the
  2543. expression will be ignored (for that instruction only). As a result, Disect
  2544. will not allow a single expression to contain BOTH 'SEA' and 'DEA' (since
  2545. this would result in the expression being ignored for instructions which
  2546. have only a source OR a destination effective address). This is why there
  2547. are two expressions permitted: one can contain 'SEA', and the other, 'DEA'.
  2548.  
  2549.     The are other conditions which will always cause auto trace mode
  2550. to be disabled: if PC is 0 or odd; if the opcode at PC cannot be identified;
  2551. if the destination effective address is hardware register INTENA; if the
  2552. instruction at PC is privileged; or if a breakpoint is reached (if the
  2553. breakpoint would normally cause an active Process to be suspended).
  2554.  
  2555.     In the right of the auto trace request window are seven check
  2556. gadgets used to control various options. The first two tell Disect whether
  2557. or not to trace ROM functions, and any external functions (not within the
  2558. memory range of the Process, and not in ROM). Whenever a JSR/BSR instruction
  2559. is reached, Disect uses the address of the subroutine to decide if it should
  2560. be traced. If not, then the JSR/BSR instruction is executed, as occurs via
  2561. pressing key 'E' normally, hence the subroutine will execute in real-time.
  2562. Note that a JSR/BSR is treated as a call to a ROM function either if the
  2563. subroutine address is in ROM, or if the instruction at this address is a JMP
  2564. into ROM (eg: exec.library). If a function is not traced, then auto trace
  2565. mode will resume after the function has returned.
  2566.     In addition, if a JMP to a ROM/external function is reached,
  2567. (as will happen often with a Process written in 'C'), then Disect will check
  2568. the address on the top of the stack to see if it is within project memory
  2569. (it should be, since this is the rts address for the ROM/external function).
  2570. If not, Disect will disable auto-trace mode and display a message ('RTS out-
  2571. side project'). If this address is in project memory, then Disect will define
  2572. a stop breakpoint at this address, and the Process will be resumed at the JMP
  2573. instruction. When the function returns, the breakpoint will be reached, at
  2574. which point auto-trace mode will be enabled, as before.
  2575.  
  2576.     The third check gadget will enable/disable writes to the history
  2577. buffer after each instruction has been traced. Whenever a JSR/BSR is executed
  2578. (ie: not traced), then the history buffer will be written to after the JSR/
  2579. BSR has completed, the function having returned successfully.
  2580.  
  2581.     The final four check gadgets will enable/disable the refreshing
  2582. of the four main program windows after each instruction has been traced.
  2583.  
  2584.     The second item in the Process menu is 'Resume Until RTS'. This
  2585. will enable auto-trace mode, with all options disabled except 'Suspend At
  2586. RTS'. This is useful for quickly getting to the end of the subroutine in
  2587. which the PC is currently located. Note that the 'Odd SEA' and 'Odd DEA'
  2588. options for auto trace mode will be as defined via the Auto Trace Mode
  2589. request window (ie: they are not automatically disabled during Resume Until
  2590. RTS).
  2591.  
  2592.     Also in the 'Process' menu is another item 'Breakpoint After
  2593. External BSR/JSR'. If you're not interested in this then read no further...
  2594.  
  2595.     Right, the reason I did this one was as follows: when tracing
  2596. ROM functions, more specifically exec.library Wait(), auto trace mode would
  2597. be disabled at the following instruction:
  2598.  
  2599.     move.w    #$4000,$dff09a    ; disable interrupts
  2600.  
  2601. Now, we cannot possibly expect to continue auto-trace mode (take my word for
  2602. it...), so what this menu item will do is to place a stop breakpoint at the
  2603. address after the last traced internal JSR/BSR to an external function.
  2604. What this means is that somewhere within the memory range of our Process is
  2605. the following:
  2606.  
  2607.     ~    ~    ~
  2608.     ~    ~    ~
  2609.     jsr    _LVOWait(a6)
  2610.  
  2611.     ~    ~    ~
  2612.     ~    ~    ~
  2613.  
  2614. Since this is the (internal) JSR which called an external function, Disect
  2615. will define the breakpoint immediately after this instruction, and resume
  2616. the Process. Once the Wait() has completed, the Process will be suspended
  2617. after the JSR instruction. NOTE: before using this menu item, in this
  2618. example it is necessary to move the PC to the instruction before the
  2619. 'move.w #,$dff09a' (ie: you MUST NOT use it with the PC at this instruction).
  2620. To move the PC to the previous instruction, you merely need to RMB on the
  2621. mnemonic of the instruction in the disassembly window. Remember this!
  2622.  
  2623. * ------------------------------------------------------------------------- *
  2624.  
  2625. 19) Hardware Monitor
  2626. ====================
  2627.  
  2628.     If enabled, the hardware monitor allows an active Process to
  2629. alter the values of certain hardware registers, without crashing the system
  2630. when the Process is suspended. This also applies to a Process being active
  2631. in the sense of only executing a single instruction. At present, the status
  2632. of DMA flags, interrupt flags, and ADK flags are monitored, as well as most
  2633. system vectors. Support is not available for any Process which alters the
  2634. VBR. In addition, the Odd Address, Trace, Illegal and Privilege Violation
  2635. vectors must not be altered by the Process, since they are used by Disect.
  2636. The hardware monitor will also track various bitplane, blitter, copper, and
  2637. colour registers.
  2638.     The hardware monitor, when enabled, allows execution of instr-
  2639. uctions which write to hardware registers. Whenever such an instruction is
  2640. single-stepped (either via the 'E' or 'T' keys, or during auto-trace mode),
  2641. if it writes to any of the registers monitored by Disect, then the required
  2642. value for the Process is automatically recorded. The Hardware menu allows
  2643. access to various request windows to allow these values to be altered
  2644. manually if necessary. Note that it is not safe to allow a Process to alter
  2645. certain CIA registers (see below).
  2646.  
  2647.     The hardware monitor is enabled/disabled either using the first
  2648. item in the 'Hardware' menu, or by pressing the '/' (or '?') key. 
  2649.  
  2650.     The 'Flags' menu item allows the current Process DMA, INT, and
  2651. ADK flags to be seen, and altered. The INT flags request window also contains
  2652. a string gadget which is used to define the Process's interrupt level, as
  2653. defined in the status register. Remember! An interrupt level of 0 means that
  2654. all interrupt levels will be enabled, while 7 will disable all. Writes to
  2655. these three registers do not need to be executed individually for the values
  2656. to be automatically monitored by Disect.
  2657.  
  2658.     The next menu item ('Registers') allows various Bitplane, Colour
  2659. and Blitter registers to be defined. These are automatically defined whenever
  2660. an instruction which writes to one of them is executed or traced. This is
  2661. required with any Process which defines them once via the 680x0, and then
  2662. does not write to them again, or write to them using a copper list.
  2663.  
  2664.     The 'Vector Addresses' menu item opens a request window contain-
  2665. ing the list of the system vectors as they will be whenever the Process is
  2666. active. Remember that certain vectors must not be altered by the Process,
  2667. since they are used by Disect. Also, the Process may not alter the VBR.
  2668.  
  2669.     The next menu item gives a sub-menu containing things relating
  2670. to the copper. The two check-items define which of COPJMP1 or COPJMP2 are to
  2671. be strobed after the required addresses have been written (either one of
  2672. these, or neither). It is not possible for Disect to automatically track the
  2673. required addresses in the same way as it is possible for DMA,etc flags,
  2674. although if any instruction is single-stepped which writes to COP1LC or
  2675. COP2LC, then Disect will store the required address. Similarly, any write
  2676. to COPJMP1 or COPJMP2 will define which of the two is to be used. This is
  2677. not possible if a Process is resumed, and the Process then writes to these
  2678. registers while it is active.    
  2679.     The next menu item allows the defined copper list to be run. This
  2680. will include any enabled interrupts. This is useful with a Process which has
  2681. a copper interrupt routine which, for example, monitors the position of a
  2682. mouse pointer. By running the copper list, with copper DMA and interrupts
  2683. enabled, and raster/sprite DMA, it is then possible to move the pointer to
  2684. a known position on the screen, and press the LMB. To return to Disect,
  2685. simply press both mouse buttons. Then, you could trace your Process, which
  2686. should respond to a mouse click over a known screen position.
  2687.  
  2688.     The next menu item ('Stack Top Address') allows you to define
  2689. the address above the stack whenever your Process directly alters a7, ie:
  2690. stack top address = highest stack address + 1. If you trace/execute a move
  2691. to a7, then this is defined automatically. Disect does not permit this if
  2692. the new stack memory is not part of your project. (In this case, you can
  2693. make it so by saving a MultiBin file). Once this address has been defined,
  2694. then Disect will not save the Process's stack when saving a Process's status
  2695. in a MultiBin file, since this memory should be part of the project. See also
  2696. the section about MultiBin files.
  2697.  
  2698.     Disect also allows two user-definable functions to be used, one
  2699. to be called immediately before the Process is resumed (Pre-Execute), and
  2700. one to be called immediately before the Process is suspended (Post-Execute).
  2701. These functions are called by the Process itself (not by Disect). Each is
  2702. defined via its own request window, which contains a string gadget for input
  2703. of the function address, and a check gadget which is used to enable/disable
  2704. the function. A 'Load' gadget also allows an executable file to be loaded to
  2705. be used as a function.
  2706.     Also in these request windows are 16 check gadgets which define
  2707. which registers must be preserved during the function, and 16 string gadgets
  2708. which allow register values to be passed to the function. If a register is
  2709. preserved, then it will be the same after the function as it was before the
  2710. function was called; any registers which are not preserved will contain the
  2711. return values from the function.
  2712.     Any enabled function will be executed in Supervisor mode. The
  2713. function MUST remain in Supervisor mode, and MUST end with an 'RTS'.
  2714.     As an example of the use of these functions, suppose you were
  2715. dissecting a Process which used the hardware to read a disk. The Process
  2716. will alter the system DMA/INT/ADK flags, which will prove to be no problem.
  2717. After single-stepping the code, you might reach the first disk read. The
  2718. Process can be resumed until after this, using a stop breakpoint. Suppose
  2719. that a little later, there is another disk read, at which point, under normal
  2720. execution, the drive motor will still be active, although under Disect, this
  2721. would not be so. In order to resume the Process until after this second disk
  2722. read, it is necessary to start the drive (otherwise, the Process will most
  2723. probably simply lock-up, with the hardware being in the state required by
  2724. the Process, not the OS). There are two alternatives: if the Process contains
  2725. a subroutine which only starts the drive, then this can be used as the Pre-
  2726. Execute function; or you could write a short bit of code to do this - perhaps
  2727. by disassembling a small part of the Process to a source file - and assemble
  2728. it as an executable file, which can be loaded to be used as the Pre-Execute
  2729. function.
  2730.     The Pre-/Post-Execute functions could also be written to setup
  2731. any required hardware registers for the Process (Pre-), then restore them
  2732. for the OS (Post-). Hopefully, this will overcome any compatibility problems
  2733. which may occur...
  2734.  
  2735.     A word of advice concerning blitter code. If you are debugging
  2736. some code which uses the blitter, then it is safe to execute such code as
  2737. long as you use the hardware monitor (assuming that the Process has already
  2738. 'killed the system'/defined any required interrupt vectors - ie: as long as
  2739. no interrupts will occur which cause the OS to be called). By defining a stop
  2740. breakpoint after the instruction which writes to BLTSIZE, and Resuming the
  2741. Process from the first instruction which writes a blitter address pointer,
  2742. the blit will begin with the hardware in the state required by the Process,
  2743. the breakpoint will be reached, Disect will wait for the blit to finish, and
  2744. then will restore the hardware for the OS. Remember that any blitter registers
  2745. written to while a Process is Resumed will not be monitored by Disect.
  2746.  
  2747.     There is one last thing I ought to mention, concerning count and
  2748. conditional breakpoints. Whenever the Process reaches either of these two
  2749. breakpoint types, then it will be suspended while Disect evaluates the break-
  2750. point in order to decide if the Process should be permanently suspended; if
  2751. not, then Disect will allow the Process to resume. The thing to note is that
  2752. when the Process is suspended (and possibly resumed), then any enabled Pre/
  2753. Post-Execute functions will be called. This will occur each time the break-
  2754. point is reached, until the Process is ultimately suspended.
  2755.  
  2756.     Now, CIA registers! When dissecting boot blocks (and what follows
  2757. them!), you're very likely to see code which alters CIA registers, for example
  2758. within disk load routines. It is safe to affect registers such as CIAA_PRA
  2759. and CIAB_PRB, in order to make a drive do something. One thing you cannot
  2760. do is affect CIA timers. (The OS tends to lock-up after: a Process under
  2761. Disect has done this, then Disect restores the OS hardware). If you wish to
  2762. run code which uses the CIA timers, it is necessary to patch this code with
  2763. your own. The simplest way is to, for example, replace a CIA timer setup/
  2764. wait loop, for some code which waits for the same number of vhposr scan lines
  2765. as the value written to the two timer byte registers. Very basic, but it does
  2766. work (even if it takes longer for something to load!). Obviously, you can
  2767. empower your inserted code with more timing-precision, if there is space
  2768. available in the original code.
  2769.  
  2770. * ------------------------------------------------------------------------- *
  2771.  
  2772. 20) 68020 Modes/Instructions
  2773. ============================
  2774.  
  2775.     The following notes concern 68020-specific addressing modes, and
  2776. instructions:
  2777.  
  2778. 1. In a 68020 effective address, only the base displacement can be replaced
  2779. by a symbol; the outer displacement cannot. For PC-relative modes, the value
  2780. displayed for the base displacement will be the result of adding it to the
  2781. PC value for the instruction. This address will be automatically replaced by
  2782. a matching program symbol (if the current preferences permit this). For modes
  2783. where the base register is an address register, if the base displacement is
  2784. a long, then an automatic program symbol match is checked for in the same
  2785. way.
  2786.  
  2787. 2. The offset and width values for bit field instructions can be replaced by
  2788. symbols, although only a single user constant symbol is permitted. When using
  2789. the symbol selection window to replace a bit field offset/width value, the
  2790. symbol search type is pre-defined, and cannot be altered. Since these values
  2791. can be replaced by only one symbol each, the facility to enter an existing
  2792. symbol name (to be used as an offset) will be disabled.
  2793.   If you replace a bit field value, the address of the BF instruction is not
  2794. logged in the usual way. This has no other implications, except it may save
  2795. you a little memory.
  2796.  
  2797. 3. When a Process exists, during calculation of a 68020 effective address,
  2798. if any memory indirection attempts to read a non-existant address, then the
  2799. effective address will be considered invalid, and will not be displayed.
  2800. Also, if you're using a pre-68020 processor, any disassembly of 68020 modes
  2801. which attempts to perform a memory indirection at an odd address will render
  2802. the EA invalid, hence it will not be displayed.
  2803.  
  2804. 4. The following 68020 instructions are not implemented: CAS, CAS2, CALLM,
  2805. RTM, PACK, UNPK.
  2806.  
  2807. * ------------------------------------------------------------------------- *
  2808.  
  2809. 21) Installing To Hard Drive
  2810. ============================
  2811.  
  2812.     Ok, on the disk, the file 'DisectV2.0' is in fact a script. This
  2813. contains an ASSIGN:
  2814.  
  2815. ASSIGN DISECT: DisectV2.0:
  2816.  
  2817.     The last name of this may be changed to reflect the partition
  2818. name where you wish to put Disect. Other than this, NOTHING else should be
  2819. altered. Simply copy the FOUR directories and FIVE files from the (floppy)
  2820. disk to (where-ever!). Important: DO NOT give the executable ('Disect.exe')
  2821. an icon in order to double-click on it to launch the program: ALWAYS double-
  2822. click on the script file ('DisectV2.0')
  2823.  
  2824. * ------------------------------------------------------------------------- *
  2825.  
  2826. 22) Contact Address
  2827. ===================
  2828.  
  2829.     If you have any problems or suggestions concerning Disect, or
  2830. if you want the full version, here's the address to which you should send
  2831. a cheque or postal order for £40 (English!!).
  2832.  
  2833.     Dave Alderson
  2834.     86, Powell Ave
  2835.     Marton
  2836.     Blackpool
  2837.     Lancashire
  2838.     England
  2839.     FY4 3HH
  2840.  
  2841.     Last, but certainly by no means least, many, many, many thanks
  2842. to Bill Westhead for helping spread the (e-mail) word, and also to the
  2843. following people for helping to test out the early versions:
  2844.  
  2845.     Marc Kelly
  2846.     Mark Manning
  2847.  
  2848. Hark!
  2849. Is that the sound
  2850. of forty pound
  2851. at the front door?
  2852. No! So,
  2853. perhaps we must
  2854. just
  2855. wait a little more ??? !!! ...
  2856.  
  2857.          ///
  2858.          \\\
  2859.          ///
  2860.              _______________________________
  2861.         |||||             |
  2862.         |||||_______________________________|
  2863.  
  2864. * ------------------------------------------------------------------------- *